From 6b35ac321440a0f64cfe6b6015e6b26fc58b6ee3 Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Thu, 28 Jan 2021 18:05:47 -0500 Subject: [PATCH] add support for pinning mfs (#116) * add support for pinning mfs * add pin conceal selector * add RemoteServicesPath Co-authored-by: Petar Maymounkov --- init.go | 3 +++ remotepin.go | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/init.go b/init.go index 448fffa..ecda304 100644 --- a/init.go +++ b/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/remotepin.go b/remotepin.go index 9da2af1..135aa66 100644 --- a/remotepin.go +++ b/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 +}