Commit 6790ef18 authored by Łukasz Magiera's avatar Łukasz Magiera

Init

parents
The MIT License
Copyright (c) 2016 Łukasz Magiera
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
test: deps
go test -race -v ./...
export IPFS_API ?= v04x.ipfs.io
gx:
go get -u github.com/whyrusleeping/gx
go get -u github.com/whyrusleeping/gx-go
deps: gx
gx --verbose install --global
gx-go rewrite
go get -t ./...
package badger
import (
badger "github.com/dgraph-io/badger/badger"
ds "github.com/ipfs/go-datastore"
dsq "github.com/ipfs/go-datastore/query"
"github.com/pkg/errors"
)
type datastore struct {
DB *badger.KV
}
func NewDatastore(path string) (*datastore, error) {
opt := badger.DefaultOptions
opt.Dir = path
opt.ValueDir = path
opt.ValueGCThreshold = 0
kv, err := badger.NewKV(&opt)
if err != nil {
return nil, err
}
return &datastore{
DB: kv,
}, nil
}
func (d *datastore) Put(key ds.Key, value interface{}) (err error) {
return errors.New("not implemented")
}
func (d *datastore) Get(key ds.Key) (value interface{}, err error) {
return nil, errors.New("not implemented")
}
func (d *datastore) Has(key ds.Key) (exists bool, err error) {
return nil, errors.New("not implemented")
}
func (d *datastore) Delete(key ds.Key) (err error) {
return errors.New("not implemented")
}
func (d *datastore) Query(q dsq.Query) (dsq.Results, error) {
return d.QueryNew(q)
}
func (d *datastore) QueryNew(q dsq.Query) (dsq.Results, error) {
return nil, errors.New("not implemented")
}
func (d *datastore) QueryOrig(q dsq.Query) (dsq.Results, error) {
return nil, errors.New("not implemented")
}
func (d *datastore) Close() (err error) {
return d.DB.Close()
}
func (d *datastore) Batch() (ds.Batch, error) {
return nil, errors.New("not implemented")
}
{
"author": "magik6k",
"bugs": {
"url": "https://github.com/ipfs/go-ds-badger"
},
"gx": {
"dvcsimport": "github.com/ipfs/go-ds-badger"
},
"gxDependencies": [
{
"author": "jbenet",
"hash": "QmRWDav6mzWseLWeYfVd5fvUKiVe9xNH29YfMF438fG364",
"name": "go-datastore",
"version": "1.2.0"
}
],
"gxVersion": "0.8.0",
"language": "go",
"license": "",
"name": "go-ds-badger",
"version": "0.1.0"
}
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