1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 23:42:20 +08:00
Files
kubo/repo/config/datastore.go
rht 8abb12e760 Add config option for flatfs no-sync
License: MIT
Signed-off-by: rht <rhtbot@gmail.com>
2016-01-12 08:22:55 -08:00

41 lines
1006 B
Go

package config
import (
"encoding/json"
)
// DefaultDataStoreDirectory is the directory to store all the local IPFS data.
const DefaultDataStoreDirectory = "datastore"
// Datastore tracks the configuration of the datastore.
type Datastore struct {
Type string
Path string
StorageMax string // in B, kB, kiB, MB, ...
StorageGCWatermark int64 // in percentage to multiply on StorageMax
GCPeriod string // in ns, us, ms, s, m, h
Params *json.RawMessage
NoSync bool
}
func (d *Datastore) ParamData() []byte {
if d.Params == nil {
return nil
}
return []byte(*d.Params)
}
type S3Datastore struct {
Region string `json:"region"`
Bucket string `json:"bucket"`
ACL string `json:"acl"`
}
// DataStorePath returns the default data store path given a configuration root
// (set an empty string to have the default configuration root)
func DataStorePath(configroot string) (string, error) {
return Path(configroot, DefaultDataStoreDirectory)
}