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>
Adin Schmahmann committed
Jan 28, 2021 at 18:05 UTC
2690c10bcacc6c5c286dcc6f2f3137dc1cf879a5
2 files changed
+22
-6
config/init.go
+3
@@ -86,6 +86,9 @@ func InitWithIdentity(identity Identity) (*Config, error) {
86
Type: "basic",
87
},
88
},
89
+ Pinning: Pinning{
90
+ RemoteServices: map[string]RemotePinningService{},
91
+ },
92
}
93
94
return conf, nil
config/remotepin.go
+19
-6
@@ -1,9 +1,8 @@
1
package config
2
3
-const (
4
- PinningTag = "Pinning"
5
- RemoteServicesTag = "RemoteServices"
6
- RemoteServicesSelector = PinningTag + "." + RemoteServicesTag
3
+var (
4
+ RemoteServicesPath = "Pinning.RemoteServices"
5
+ PinningConcealSelector = []string{"Pinning", "RemoteServices", "*", "API", "Key"}
6
)
7
8
type Pinning struct {
@@ -11,10 +10,24 @@ type Pinning struct {
10
}
11
12
type RemotePinningService struct {
14
- Api RemotePinningServiceApi
13
+ API RemotePinningServiceAPI
14
+ Policies RemotePinningServicePolicies
15
}
16
17
-type RemotePinningServiceApi struct {
17
+type RemotePinningServiceAPI struct {
18
Endpoint string
19
Key string
20
}
21
+
22
+type RemotePinningServicePolicies struct {
23
+ MFS RemotePinningServiceMFSPolicy
24
+}
25
+
26
+type RemotePinningServiceMFSPolicy struct {
27
+ // Enable enables watching for changes in MFS and re-pinning the MFS root cid whenever a change occurs.
28
+ Enable bool
29
+ // Name is the pin name for MFS.
30
+ PinName string
31
+ // RepinInterval determines the repin interval when the policy is enabled. In ns, us, ms, s, m, h.
32
+ RepinInterval string
33
+}