Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: storage: --allow/deny-type flag in storage attach cli #332

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cmd/curio/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ over time
Name: "allow-to",
Usage: "path groups allowed to pull data from this path (allow all if not specified)",
},
&cli.StringSliceFlag{
Name: "allow-types",
Usage: "file types to allow storing in this path",
},
&cli.StringSliceFlag{
Name: "deny-types",
Usage: "file types to deny storing in this path",
},
},
Action: func(cctx *cli.Context) error {
minerApi, closer, err := rpc.GetCurioAPI(cctx)
Expand Down Expand Up @@ -126,6 +134,19 @@ over time
}
}

for _, t := range cctx.StringSlice("allow-types") {
_, err := storiface.TypeFromString(t)
if err != nil {
return xerrors.Errorf("parsing allow-types: %w", err)
}
}
for _, t := range cctx.StringSlice("deny-types") {
_, err := storiface.TypeFromString(t)
if err != nil {
return xerrors.Errorf("parsing deny-types: %w", err)
}
}

cfg := storiface.LocalStorageMeta{
ID: storiface.ID(uuid.New().String()),
Weight: cctx.Uint64("weight"),
Expand All @@ -134,6 +155,9 @@ over time
MaxStorage: uint64(maxStor),
Groups: cctx.StringSlice("groups"),
AllowTo: cctx.StringSlice("allow-to"),

AllowTypes: cctx.StringSlice("allow-types"),
DenyTypes: cctx.StringSlice("deny-types"),
}

if !(cfg.CanStore || cfg.CanSeal) {
Expand Down
18 changes: 10 additions & 8 deletions documentation/en/curio-cli/curio.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,16 @@ DESCRIPTION:


OPTIONS:
--init initialize the path first (default: false)
--weight value (for init) path weight (default: 10)
--seal (for init) use path for sealing (default: false)
--store (for init) use path for long-term storage (default: false)
--max-storage value (for init) limit storage space for sectors (expensive for very large paths!)
--groups value [ --groups value ] path group names
--allow-to value [ --allow-to value ] path groups allowed to pull data from this path (allow all if not specified)
--help, -h show help
--init initialize the path first (default: false)
--weight value (for init) path weight (default: 10)
--seal (for init) use path for sealing (default: false)
--store (for init) use path for long-term storage (default: false)
--max-storage value (for init) limit storage space for sectors (expensive for very large paths!)
--groups value [ --groups value ] path group names
--allow-to value [ --allow-to value ] path groups allowed to pull data from this path (allow all if not specified)
--allow-types value [ --allow-types value ] file types to allow storing in this path
--deny-types value [ --deny-types value ] file types to deny storing in this path
--help, -h show help
```

#### curio cli storage detach
Expand Down
Loading