Skip to content

Commit

Permalink
go-ipfs-config: add support for pinning mfs (ipfs#116)
Browse files Browse the repository at this point in the history
* add support for pinning mfs
* add pin conceal selector
* add RemoteServicesPath

Co-authored-by: Petar Maymounkov <[email protected]>
  • Loading branch information
aschmahmann and petar authored Jan 28, 2021
1 parent fc6e614 commit aebf628
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func InitWithIdentity(identity Identity) (*Config, error) {
Type: "basic",
},
},
Pinning: Pinning{
RemoteServices: map[string]RemotePinningService{},
},
}

return conf, nil
Expand Down
25 changes: 19 additions & 6 deletions config/remotepin.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
package config

const (
PinningTag = "Pinning"
RemoteServicesTag = "RemoteServices"
RemoteServicesSelector = PinningTag + "." + RemoteServicesTag
var (
RemoteServicesPath = "Pinning.RemoteServices"
PinningConcealSelector = []string{"Pinning", "RemoteServices", "*", "API", "Key"}
)

type Pinning struct {
RemoteServices map[string]RemotePinningService
}

type RemotePinningService struct {
Api RemotePinningServiceApi
API RemotePinningServiceAPI
Policies RemotePinningServicePolicies
}

type RemotePinningServiceApi struct {
type RemotePinningServiceAPI struct {
Endpoint string
Key string
}

type RemotePinningServicePolicies struct {
MFS RemotePinningServiceMFSPolicy
}

type RemotePinningServiceMFSPolicy struct {
// Enable enables watching for changes in MFS and re-pinning the MFS root cid whenever a change occurs.
Enable bool
// Name is the pin name for MFS.
PinName string
// RepinInterval determines the repin interval when the policy is enabled. In ns, us, ms, s, m, h.
RepinInterval string
}

0 comments on commit aebf628

Please sign in to comment.