store

package
v0.0.0-...-5c8abdd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package store provides implementation of LevelDB key/value database.

Create or open a database:

// The returned DB instance is safe for concurrent use. Which mean that all
// DB's methods may be called concurrently from multiple goroutine.
db, err := store.NewStore("path/to/db")
...
defer db.Close()
...

Read or modify the database content:

// Remember that the contents of the returned slice should not be modified.
data := db.Get(key)
...
db.Put(key), []byte("value"))
...
db.Delete(key)
...

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStore

func NewStore(path string) (iface.Storer, error)

NewStore create a new Store implemented by LevelDB

func WrapPrefixStore

func WrapPrefixStore(prefix string, store iface.Storer) iface.Storer

Types

type LevelDBStore

type LevelDBStore struct {
	// contains filtered or unexported fields
}

func (*LevelDBStore) Close

func (s *LevelDBStore) Close() error

Close closes the service

func (*LevelDBStore) Delete

func (s *LevelDBStore) Delete(key string)

func (*LevelDBStore) Get

func (s *LevelDBStore) Get(key string) []byte

Get returns the value corresponding to the given key

func (*LevelDBStore) Set

func (s *LevelDBStore) Set(key string, value []byte)

Set stores the url for a given fingerprint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL