rethinkstore

package
v0.4.8 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package rethinkstore implements a store that saves all the segments in a RethinkDB database.

Index

Constants

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

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

	// DefaultURL is the default URL of the database.
	DefaultURL = "rethinkdb:28015"

	// DefaultDB is the default database.
	DefaultDB = "test"

	// DefaultHard is whether to use hard durability by default.
	DefaultHard = true
)

Variables

This section is empty.

Functions

func RegisterFlags

func RegisterFlags()

RegisterFlags register the flags used by InitializeWithFlags.

Types

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

	// The URL of the PostgreSQL database, such as "localhost:28015" order
	// "localhost:28015,localhost:28016,localhost:28017".
	URL string

	// The database name
	DB string

	// Whether to use hard durability.
	Hard bool
}

Config contains configuration options for the store.

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.

type Store

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

Store is the type that implements github.com/stratumn/go-core/store.Adapter.

func Initialize

func Initialize(config *Config, create, drop bool) *Store

Initialize initializes a rethinkdb store adapter

func InitializeWithFlags

func InitializeWithFlags(version, commit string) *Store

InitializeWithFlags should be called after RegisterFlags and flag.Parse to initialize a rethinkdb adapter using flag values.

func New

func New(config *Config) (*Store, error)

New creates an instance of a Store.

func (*Store) AddEvidence

func (a *Store) AddEvidence(ctx context.Context, linkHash chainscript.LinkHash, evidence *chainscript.Evidence) error

AddEvidence implements github.com/stratumn/go-core/store.EvidenceWriter.AddEvidence.

func (*Store) AddStoreEventChannel

func (a *Store) AddStoreEventChannel(eventChan chan *store.Event)

AddStoreEventChannel implements github.com/stratumn/go-core/store.Adapter.AddStoreEventChannel.

func (*Store) Clean

func (a *Store) Clean() error

Clean removes all documents from the tables.

func (*Store) Create

func (a *Store) Create() error

Create creates the database tables and indexes.

func (a *Store) CreateLink(ctx context.Context, link *chainscript.Link) (chainscript.LinkHash, error)

CreateLink implements github.com/stratumn/go-core/store.LinkWriter.CreateLink.

func (*Store) DeleteValue

func (a *Store) DeleteValue(ctx context.Context, key []byte) ([]byte, error)

DeleteValue implements github.com/stratumn/go-core/store.KeyValueStore.DeleteValue.

func (*Store) Drop

func (a *Store) Drop() error

Drop drops the database tables and indexes.

func (*Store) Exists

func (a *Store) Exists() (bool, error)

Exists returns whether the database tables exists.

func (*Store) FindSegments

func (a *Store) FindSegments(ctx context.Context, filter *store.SegmentFilter) (*types.PaginatedSegments, error)

FindSegments implements github.com/stratumn/go-core/store.SegmentReader.FindSegments.

func (*Store) GetEvidences

func (a *Store) GetEvidences(ctx context.Context, linkHash chainscript.LinkHash) (types.EvidenceSlice, error)

GetEvidences implements github.com/stratumn/go-core/store.EvidenceReader.GetEvidences.

func (*Store) GetInfo

func (a *Store) GetInfo(ctx context.Context) (interface{}, error)

GetInfo implements github.com/stratumn/go-core/store.Adapter.GetInfo.

func (*Store) GetMapIDs

func (a *Store) GetMapIDs(ctx context.Context, filter *store.MapFilter) ([]string, error)

GetMapIDs implements github.com/stratumn/go-core/store.SegmentReader.GetMapIDs.

func (*Store) GetSegment

func (a *Store) GetSegment(ctx context.Context, linkHash chainscript.LinkHash) (*chainscript.Segment, error)

GetSegment implements github.com/stratumn/go-core/store.SegmentReader.GetSegment.

func (*Store) GetValue

func (a *Store) GetValue(ctx context.Context, key []byte) ([]byte, error)

GetValue implements github.com/stratumn/go-core/store.KeyValueStore.GetValue.

func (*Store) NewBatch

func (a *Store) NewBatch(ctx context.Context) (store.Batch, error)

NewBatch implements github.com/stratumn/go-core/store.Adapter.NewBatch.

func (*Store) SetValue

func (a *Store) SetValue(ctx context.Context, key, value []byte) error

SetValue implements github.com/stratumn/go-core/store.KeyValueStore.SetValue.

Jump to

Keyboard shortcuts

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