From bb1649389753791edb06c6faa6cc67fc3b9ac694 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Thu, 28 Jan 2021 18:05:47 -0500 Subject: [PATCH] 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 --- config/init.go | 3 +++ config/remotepin.go | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/config/init.go b/config/init.go index 448fffa73c1b..ecda3047ddbe 100644 --- a/config/init.go +++ b/config/init.go @@ -86,6 +86,9 @@ func InitWithIdentity(identity Identity) (*Config, error) { Type: "basic", }, }, + Pinning: Pinning{ + RemoteServices: map[string]RemotePinningService{}, + }, } return conf, nil diff --git a/config/remotepin.go b/config/remotepin.go index 9da2af1bf0b4..135aa664d174 100644 --- a/config/remotepin.go +++ b/config/remotepin.go @@ -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 +}