@cryptotaxi247 / kubo / commits / 14cf564b3

go-ipfs-config: Add fixed period repo GC + test

License: MIT Signed-off-by: rht <rhtbot@gmail.com>

rht committed Oct 20, 2015 at 10:56 UTC 14cf564b3a1a7d7956677c60448b724c45a3b2f7
2 files changed +10 -4
config/datastore.go
+5 -2
@@ -5,8 +5,11 @@ const DefaultDataStoreDirectory = "datastore"
5
6 // Datastore tracks the configuration of the datastore.
7 type Datastore struct {
8 - Type string
9 - Path string
8 + Type string
9 + Path string
10 + StorageMax string // in B, kB, kiB, MB, ...
11 + StorageGCWatermark int64 // in percentage to multiply on StorageMax
12 + GCPeriod string // in ns, us, ms, s, m, h
13 }
14
15 // DataStorePath returns the default data store path given a configuration root
config/init.go
+5 -2
@@ -87,8 +87,11 @@ func datastoreConfig() (*Datastore, error) {
87 return nil, err
88 }
89 return &Datastore{
90 - Path: dspath,
91 - Type: "leveldb",
90 + Path: dspath,
91 + Type: "leveldb",
92 + StorageMax: "10GB",
93 + StorageGCWatermark: 90, // 90%
94 + GCPeriod: "1h",
95 }, nil
96 }
97