dummystore

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package dummystore implements a store that saves all the segments in memory.

It can be used for testing, but it's unoptimized and not designed for production.

Index

Constants

View Source
const (
	// Name is the name set in the store's information.
	Name = "dummy"

	// Description is the description set in the store's information.
	Description = "Stratumn Dummy Store"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	*store.BufferedBatch
	// contains filtered or unexported fields
}

Batch is the type that implements github.com/stratumn/sdk/store.Batch.

func NewBatch

func NewBatch(a *DummyStore) *Batch

NewBatch creates a new Batch

func (*Batch) Write

func (b *Batch) Write() error

Write implements github.com/stratumn/sdk/store.Adapter.Write.

type Config

type Config struct {
	// A version string that will be set in the store's information.
	Version string

	// A git commit hash that will be set in the store's information.
	Commit string
}

Config contains configuration options for the store.

type DummyStore

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

DummyStore is the type that implements github.com/stratumn/sdk/store.Adapter.

func New

func New(config *Config) *DummyStore

New creates an instance of a DummyStore.

func (*DummyStore) AddDidSaveChannel

func (a *DummyStore) AddDidSaveChannel(saveChan chan *cs.Segment)

AddDidSaveChannel implements github.com/stratumn/sdk/fossilizer.Store.AddDidSaveChannel.

func (*DummyStore) DeleteSegment

func (a *DummyStore) DeleteSegment(linkHash *types.Bytes32) (*cs.Segment, error)

DeleteSegment implements github.com/stratumn/sdk/store.Adapter.DeleteSegment.

func (*DummyStore) DeleteValue

func (a *DummyStore) DeleteValue(key []byte) ([]byte, error)

DeleteValue implements github.com/stratumn/sdk/store.Adapter.DeleteValue.

func (*DummyStore) FindSegments

func (a *DummyStore) FindSegments(filter *store.SegmentFilter) (cs.SegmentSlice, error)

FindSegments implements github.com/stratumn/sdk/store.Adapter.FindSegments.

func (*DummyStore) GetInfo

func (a *DummyStore) GetInfo() (interface{}, error)

GetInfo implements github.com/stratumn/sdk/store.Adapter.GetInfo.

func (*DummyStore) GetMapIDs

func (a *DummyStore) GetMapIDs(filter *store.MapFilter) ([]string, error)

GetMapIDs implements github.com/stratumn/sdk/store.Adapter.GetMapIDs.

func (*DummyStore) GetSegment

func (a *DummyStore) GetSegment(linkHash *types.Bytes32) (*cs.Segment, error)

GetSegment implements github.com/stratumn/sdk/store.Adapter.GetSegment.

func (*DummyStore) GetValue

func (a *DummyStore) GetValue(key []byte) ([]byte, error)

GetValue implements github.com/stratumn/sdk/store.Adapter.GetValue.

func (*DummyStore) NewBatch

func (a *DummyStore) NewBatch() (store.Batch, error)

NewBatch implements github.com/stratumn/sdk/store.Adapter.NewBatch.

func (*DummyStore) SaveSegment

func (a *DummyStore) SaveSegment(segment *cs.Segment) error

SaveSegment implements github.com/stratumn/sdk/store.Adapter.SaveSegment.

func (*DummyStore) SaveValue

func (a *DummyStore) SaveValue(key, value []byte) error

SaveValue implements github.com/stratumn/sdk/store.Adapter.SaveValue.

type Info

type Info struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Version     string `json:"version"`
	Commit      string `json:"commit"`
}

Info is the info returned by GetInfo.

Jump to

Keyboard shortcuts

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