GithubHelp home page GithubHelp logo

leveldb-go's Introduction

This is a LevelDB library for the Go programming language.

To download and install from source:
$ go get code.google.com/p/leveldb-go/leveldb

Unless otherwise noted, the LevelDB-Go source files are distributed
under the BSD-style license found in the LICENSE file.

Contributions should follow the same procedure as for the Go project:
http://golang.org/doc/contribute.html

leveldb-go's People

Contributors

xushiwei avatar

Stargazers

xiazemin avatar Jeffrey H. Johnson avatar Curtis avatar  avatar Song Chen avatar  avatar  avatar Angus H. avatar Lucien avatar screscent avatar 黑夜路人 avatar HaoLin avatar  avatar

Watchers

HaoLin avatar  avatar Piotr Narewski avatar James Cloos avatar yanglei avatar  avatar

leveldb-go's Issues

panic: leveldb/table: invalid table (could not stat file)

Hi,

I tried to use leveldb-go, but I got the following error message

panic: leveldb/table: invalid table (could not stat file)

When attempting to run the snippet hereunder.

Is this a bug or did I do something wrong in this code ?

Thanks,

Serge.

package main

import (
"code.google.com/p/leveldb-go/leveldb/db"
"code.google.com/p/leveldb-go/leveldb/table"
"fmt"
//"runtime"
)

const (
DBFILE = "/home/serge2/workspace/scanner_go_test_7/tmp/leveldb_4.db"
)

var DBFS = db.DefaultFileSystem

func Check(e error) {
if e != nil {
panic(e)
}
}

func main() {

Connection, e := DBFS.Create(DBFILE)
Check(e)

// -- Writer :
w := table.NewWriter(Connection, nil)
e = w.Set([]byte("Hello"), []byte("World"), nil)
Check(e)
w.Close()

//  -- Reader :
r := table.NewReader(Connection, nil)
b := []byte("")
iter := r.Find(b, nil)
for iter.Next() {
    k := iter.Key()
    v := iter.Value()
    fmt.Printf("key = %s\n", k)
    fmt.Printf("value = %s\n", v)
}

e = iter.Close()
Check(e)

e = r.Close()
Check(e)

}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.