diff --git a/repo/config/datastore.go b/repo/config/datastore.go index aec78e0e1..2b2bcb518 100644 --- a/repo/config/datastore.go +++ b/repo/config/datastore.go @@ -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) { diff --git a/repo/config/init.go b/repo/config/init.go index ae41b68e9..1ab42f6ff 100644 --- a/repo/config/init.go +++ b/repo/config/init.go @@ -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", }, }, diff --git a/repo/fsrepo/datastores.go b/repo/fsrepo/datastores.go index 95fa04503..5fbd2237e 100644 --- a/repo/fsrepo/datastores.go +++ b/repo/fsrepo/datastores.go @@ -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) {