forky

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2019 License: LGPL-3.0 Imports: 9 Imported by: 0

README

Forky

Ethereum Swarm Chunk Store experiment. Intended only for demonstration of possible performance improvements.

Etymology

Name forky comes from the default Swarm fixed chunk data size of 4096 bytes or 4K (four kay -> forky) bytes, as this storage supports only fixed sized data chunks.

It is also a Toy Story 4 character. Given that Debian project uses Toy Story character names for release codenames, such correlation is quite nice.

Tests

Default tests are configured to validate correctness of implementations:

go test -v 

To see results with different number of chunks tests can be run with optional arguments:

go test -timeout 30m -v github.com/janos/forky/leveldb -chunks 1000000

This will run both plain LevelDB store and Forky with LevelDB MetaStore tests with timings for comparison. A high number of chunks require setting an appropriate timeout flag, also.

License

The forky library is licensed under the GNU Lesser General Public License v3.0, also included in our repository in the COPYING file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDBClosed = errors.New("closed database")

Functions

This section is empty.

Types

type Interface

type Interface interface {
	Get(addr chunk.Address) (ch chunk.Chunk, err error)
	Has(addr chunk.Address) (yes bool, err error)
	Put(ch chunk.Chunk) (err error)
	Delete(addr chunk.Address) (err error)
	Count() (count int, err error)
	Iterate(func(ch chunk.Chunk) (stop bool, err error)) (err error)
	Close() (err error)
}

type Meta

type Meta struct {
	Size   uint16
	Offset int64
}

func (*Meta) MarshalBinary

func (m *Meta) MarshalBinary() (data []byte, err error)

func (*Meta) String

func (m *Meta) String() (s string)

func (*Meta) UnmarshalBinary

func (m *Meta) UnmarshalBinary(data []byte) error

type MetaStore

type MetaStore interface {
	Get(addr chunk.Address) (*Meta, error)
	Set(addr chunk.Address, shard uint8, reclaimed bool, m *Meta) error
	Remove(addr chunk.Address, shard uint8) error
	Count() (int, error)
	Iterate(func(chunk.Address, *Meta) (stop bool, err error)) error
	FreeOffset(shard uint8) (int64, error)
	Close() error
}

type Store

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

func NewStore

func NewStore(path string, maxChunkSize int, metaStore MetaStore, noCache bool) (s *Store, err error)

func (*Store) Close

func (s *Store) Close() (err error)

func (*Store) Count added in v0.1.1

func (s *Store) Count() (count int, err error)

func (*Store) Delete

func (s *Store) Delete(addr chunk.Address) (err error)

func (*Store) Get

func (s *Store) Get(addr chunk.Address) (ch chunk.Chunk, err error)

func (*Store) Has

func (s *Store) Has(addr chunk.Address) (yes bool, err error)

func (*Store) Iterate added in v0.1.2

func (s *Store) Iterate(fn func(chunk.Chunk) (stop bool, err error)) (err error)

func (*Store) Put

func (s *Store) Put(ch chunk.Chunk) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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