go-ipfs-config: add support for pinning mfs (#116)

* add support for pinning mfs
* add pin conceal selector
* add RemoteServicesPath

Co-authored-by: Petar Maymounkov <petarm@gmail.com>
This commit is contained in:
Adin Schmahmann 2021-01-28 18:05:47 -05:00 committed by GitHub
parent ba6b029b96
commit 2690c10bca
2 changed files with 22 additions and 6 deletions

View File

@ -86,6 +86,9 @@ func InitWithIdentity(identity Identity) (*Config, error) {
Type: "basic",
},
},
Pinning: Pinning{
RemoteServices: map[string]RemotePinningService{},
},
}
return conf, nil

View File

@ -1,9 +1,8 @@
package config
const (
PinningTag = "Pinning"
RemoteServicesTag = "RemoteServices"
RemoteServicesSelector = PinningTag + "." + RemoteServicesTag
var (
RemoteServicesPath = "Pinning.RemoteServices"
PinningConcealSelector = []string{"Pinning", "RemoteServices", "*", "API", "Key"}
)
type Pinning struct {
@ -11,10 +10,24 @@ type Pinning struct {
}
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
}