Documentation ¶
Overview ¶
Package tmstore implements a store that saves all the segments in a tendermint app
Index ¶
- Constants
- type Config
- type Info
- type TMStore
- func (t *TMStore) AddEvidence(ctx context.Context, linkHash chainscript.LinkHash, ...) error
- func (t *TMStore) AddStoreEventChannel(storeChan chan *store.Event)
- func (t *TMStore) CreateLink(ctx context.Context, link *chainscript.Link) (chainscript.LinkHash, error)
- func (t *TMStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (segments *types.PaginatedSegments, err error)
- func (t *TMStore) GetEvidences(ctx context.Context, linkHash chainscript.LinkHash) (evidences types.EvidenceSlice, err error)
- func (t *TMStore) GetInfo(ctx context.Context) (interface{}, error)
- func (t *TMStore) GetMapIDs(ctx context.Context, filter *store.MapFilter) (ids []string, err error)
- func (t *TMStore) GetSegment(ctx context.Context, linkHash chainscript.LinkHash) (segment *chainscript.Segment, err error)
- func (t *TMStore) NewBatch(ctx context.Context) (store.Batch, error)
- func (t *TMStore) RetryStartWebsocket(ctx context.Context, interval time.Duration) error
- func (t *TMStore) StartWebsocket(ctx context.Context) (err error)
- func (t *TMStore) StopWebsocket(ctx context.Context) (err error)
Constants ¶
const ( // Name is the name set in the store's information. Name = "tm" // Description is the description set in the store's information. Description = "Stratumn's Tendermint Store" // DefaultEndpoint is the default Tendermint endpoint. DefaultEndpoint = "tcp://127.0.0.1:46657" // DefaultWsRetryInterval is the default interval between Tendermint Websocket connection attempts. DefaultWsRetryInterval = 5 * time.Second // ErrAlreadySubscribed is the error returned by tendermint's rpc client when we try to suscribe twice to the same event ErrAlreadySubscribed = "already subscribed" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 }
Config contains configuration options for the store.
type Info ¶
type Info struct { Name string `json:"name"` Description string `json:"description"` TMAppInfo interface{} `json:"tmAppDescription"` Version string `json:"version"` Commit string `json:"commit"` }
Info is the info returned by GetInfo.
type TMStore ¶
type TMStore struct {
// contains filtered or unexported fields
}
TMStore is the type that implements github.com/stratumn/go-core/store.Adapter.
func (*TMStore) AddEvidence ¶ added in v0.2.0
func (t *TMStore) AddEvidence(ctx context.Context, linkHash chainscript.LinkHash, evidence *chainscript.Evidence) error
AddEvidence implements github.com/stratumn/go-core/store.EvidenceWriter.AddEvidence.
func (*TMStore) AddStoreEventChannel ¶ added in v0.2.0
AddStoreEventChannel implements github.com/stratumn/go-core/store.Adapter.AddStoreEventChannel.
func (*TMStore) CreateLink ¶ added in v0.2.0
func (t *TMStore) CreateLink(ctx context.Context, link *chainscript.Link) (chainscript.LinkHash, error)
CreateLink implements github.com/stratumn/go-core/store.LinkWriter.CreateLink.
func (*TMStore) FindSegments ¶
func (t *TMStore) FindSegments(ctx context.Context, filter *store.SegmentFilter) (segments *types.PaginatedSegments, err error)
FindSegments implements github.com/stratumn/go-core/store.SegmentReader.FindSegments.
func (*TMStore) GetEvidences ¶ added in v0.2.0
func (t *TMStore) GetEvidences(ctx context.Context, linkHash chainscript.LinkHash) (evidences types.EvidenceSlice, err error)
GetEvidences implements github.com/stratumn/go-core/store.EvidenceReader.GetEvidences.
func (*TMStore) GetMapIDs ¶
GetMapIDs implements github.com/stratumn/go-core/store.SegmentReader.GetMapIDs.
func (*TMStore) GetSegment ¶
func (t *TMStore) GetSegment(ctx context.Context, linkHash chainscript.LinkHash) (segment *chainscript.Segment, err error)
GetSegment implements github.com/stratumn/go-core/store.SegmentReader.GetSegment.
func (*TMStore) RetryStartWebsocket ¶
RetryStartWebsocket starts the websocket client and retries on errors.
func (*TMStore) StartWebsocket ¶
StartWebsocket starts the websocket client and wait for New Block events.