Skip to content

Commit

Permalink
Add sbs support
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
  • Loading branch information
Kubuxu committed Mar 17, 2017
1 parent 4cd09ce commit a0be5f9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,12 @@
"hash": "QmaFNtBAXX4nVMQWbUqNysXyhevUj1k4B1y5uS45LC7Vw9",
"name": "fuse",
"version": "0.1.3"
},
{
"author": "kubuxu",
"hash": "QmPAFr5hRxsceHEW9ZCkVXRsSSbFdfSvDqz5ancGEeQDzE",
"name": "go-sbs",
"version": "0.1.0"
}
],
"gxVersion": "0.10.0",
Expand Down
12 changes: 12 additions & 0 deletions repo/fsrepo/datastores.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"path/filepath"

repo "github.com/ipfs/go-ipfs/repo"
sbs "gx/ipfs/QmPAFr5hRxsceHEW9ZCkVXRsSSbFdfSvDqz5ancGEeQDzE/go-sbs"

measure "gx/ipfs/QmNPv1yzXBqxzqjfTzHCeBoicxxZgHzLezdY2hMCZ3r6EU/go-ds-measure"
flatfs "gx/ipfs/QmXZEfbEv9sXG9JnLoMNhREDMDgkq5Jd7uWJ7d77VJ4pxn/go-ds-flatfs"
Expand Down Expand Up @@ -49,6 +50,8 @@ func (r *FSRepo) constructDatastore(params map[string]interface{}) (repo.Datasto

case "levelds":
return r.openLeveldbDatastore(params)
case "sbs":
return r.openSbsDatastore(params)
default:
return nil, fmt.Errorf("unknown datastore type: %s", params["type"])
}
Expand Down Expand Up @@ -124,3 +127,12 @@ func (r *FSRepo) openLeveldbDatastore(params map[string]interface{}) (repo.Datas
func (r *FSRepo) openMeasureDB(prefix string, child repo.Datastore) (repo.Datastore, error) {
return measure.New(prefix, child), nil
}

func (r *FSRepo) openSbsDatastore(params map[string]interface{}) (repo.Datastore, error) {
p := params["path"].(string)
if !filepath.IsAbs(p) {
p = filepath.Join(r.path, p)
}

return sbs.NewSbsDS(p)
}

0 comments on commit a0be5f9

Please sign in to comment.