Skip to content

Commit

Permalink
feat: storage: --allow/deny-type flag in storage attach cli (#332)
Browse files Browse the repository at this point in the history
* storage: path type in attach

* make gen
  • Loading branch information
magik6k authored Dec 6, 2024
1 parent 738bba9 commit fd9f8c5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
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

0 comments on commit fd9f8c5

Please sign in to comment.