Commit 0f8b6032 authored by Kevin Atkinson's avatar Kevin Atkinson Committed by Jeromy

cleanup and bug fixes

License: MIT
Signed-off-by: default avatarKevin Atkinson <k@kevina.org>
parent 7875674c
package config package config
import (
"encoding/json"
)
// DefaultDataStoreDirectory is the directory to store all the local IPFS data. // DefaultDataStoreDirectory is the directory to store all the local IPFS data.
const DefaultDataStoreDirectory = "datastore" const DefaultDataStoreDirectory = "datastore"
...@@ -8,8 +12,12 @@ type Datastore struct { ...@@ -8,8 +12,12 @@ type Datastore struct {
StorageMax string // in B, kB, kiB, MB, ... StorageMax string // in B, kB, kiB, MB, ...
StorageGCWatermark int64 // in percentage to multiply on StorageMax StorageGCWatermark int64 // in percentage to multiply on StorageMax
GCPeriod string // in ns, us, ms, s, m, h 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{} Spec map[string]interface{}
...@@ -17,27 +25,6 @@ type Datastore struct { ...@@ -17,27 +25,6 @@ type Datastore struct {
BloomFilterSize int 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 // DataStorePath returns the default data store path given a configuration root
// (set an empty string to have the default configuration root) // (set an empty string to have the default configuration root)
func DataStorePath(configroot string) (string, error) { func DataStorePath(configroot string) (string, error) {
......
...@@ -95,7 +95,7 @@ func datastoreConfig() (*Datastore, error) { ...@@ -95,7 +95,7 @@ func datastoreConfig() (*Datastore, error) {
"child": map[string]interface{}{ "child": map[string]interface{}{
"type": "flatfs", "type": "flatfs",
"path": "blocks", "path": "blocks",
"nosync": false, "sync": true,
"shardFunc": "/repo/flatfs/shard/v1/next-to-last/2", "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
}, },
}, },
......
...@@ -94,7 +94,7 @@ func (r *FSRepo) openFlatfsDatastore(params map[string]interface{}) (repo.Datast ...@@ -94,7 +94,7 @@ func (r *FSRepo) openFlatfsDatastore(params map[string]interface{}) (repo.Datast
return nil, err 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) { func (r *FSRepo) openLeveldbDatastore(params map[string]interface{}) (repo.Datastore, error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment