mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 18:37:45 +08:00
cleanup and bug fixes
License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>
This commit is contained in:
parent
7875674cae
commit
0f8b6032da
@ -1,5 +1,9 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// DefaultDataStoreDirectory is the directory to store all the local IPFS data.
|
||||
const DefaultDataStoreDirectory = "datastore"
|
||||
|
||||
@ -8,8 +12,12 @@ type Datastore struct {
|
||||
StorageMax string // in B, kB, kiB, MB, ...
|
||||
StorageGCWatermark int64 // in percentage to multiply on StorageMax
|
||||
GCPeriod string // in ns, us, ms, s, m, h
|
||||
Path string
|
||||
NoSync bool // deprecated
|
||||
|
||||
// deprecated fields, use Spec
|
||||
Type string `json:",omitempty"`
|
||||
Path string `json:",omitempty"`
|
||||
NoSync bool `json:",omitempty"`
|
||||
Params *json.RawMessage `json:",omitempty"`
|
||||
|
||||
Spec map[string]interface{}
|
||||
|
||||
@ -17,27 +25,6 @@ type Datastore struct {
|
||||
BloomFilterSize int
|
||||
}
|
||||
|
||||
type S3Datastore struct {
|
||||
Region string `json:"region"`
|
||||
Bucket string `json:"bucket"`
|
||||
ACL string `json:"acl"`
|
||||
}
|
||||
|
||||
type FlatDS struct {
|
||||
Path string
|
||||
ShardFunc string
|
||||
Sync bool
|
||||
}
|
||||
|
||||
type LevelDB struct {
|
||||
Path string
|
||||
Compression string
|
||||
}
|
||||
|
||||
type SbsDS struct {
|
||||
Path string
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
||||
@ -95,7 +95,7 @@ func datastoreConfig() (*Datastore, error) {
|
||||
"child": map[string]interface{}{
|
||||
"type": "flatfs",
|
||||
"path": "blocks",
|
||||
"nosync": false,
|
||||
"sync": true,
|
||||
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
|
||||
},
|
||||
},
|
||||
|
||||
@ -94,7 +94,7 @@ func (r *FSRepo) openFlatfsDatastore(params map[string]interface{}) (repo.Datast
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return flatfs.CreateOrOpen(p, shardFun, params["nosync"].(bool))
|
||||
return flatfs.CreateOrOpen(p, shardFun, params["sync"].(bool))
|
||||
}
|
||||
|
||||
func (r *FSRepo) openLeveldbDatastore(params map[string]interface{}) (repo.Datastore, error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user