tmstore

package
v0.0.7-dev Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package tmstore implements a store that saves all the segments in a tendermint app

Index

Constants

View Source
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 TM Store"

	// DefaultEndpoint is the default Tendermint endpoint
	DefaultEndpoint = "tcp://127.0.0.1:46657"

	// DefaultWsRetryInterval is the default interval between Tendermint Wbesocket connection tries
	DefaultWsRetryInterval = 5 * time.Second
)

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

	// Endoint used to communicate with Tendermint core
	Endpoint 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 TMClient

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

TMClient is the type that implements the Tendermint RPC Client interface

func NewTMClient

func NewTMClient(remote string) *TMClient

NewTMClient creates a new HTTPClient that communicates with Tendermint

func (*TMClient) ABCIInfo

func (c *TMClient) ABCIInfo() (*ctypes.ResultABCIInfo, error)

ABCIInfo returns info about the Tendermint App

func (*TMClient) ABCIQuery

func (c *TMClient) ABCIQuery(query []byte) (*ctypes.ResultABCIQuery, error)

ABCIQuery sends a query to the Tendermint App

func (*TMClient) BroadcastTxAsync

func (c *TMClient) BroadcastTxAsync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

BroadcastTxAsync broadcasts a Tx to the Tendermint Core

func (*TMClient) BroadcastTxCommit

func (c *TMClient) BroadcastTxCommit(tx types.Tx) (*ctypes.ResultBroadcastTxCommit, error)

BroadcastTxCommit broadcasts a Tx to the Tendermint Core

func (*TMClient) BroadcastTxSync

func (c *TMClient) BroadcastTxSync(tx types.Tx) (*ctypes.ResultBroadcastTx, error)

BroadcastTxSync broadcasts a Tx synchronously to the Tendermint Core

func (*TMClient) GetEventChannels

func (c *TMClient) GetEventChannels() (chan json.RawMessage, chan error, chan struct{})

GetEventChannels returns the results and error channel from the websocket

func (*TMClient) StartWebsocket

func (c *TMClient) StartWebsocket() error

StartWebsocket starts up a websocket and a listener goroutine if already started, do nothing

func (*TMClient) Status

func (c *TMClient) Status() (*ctypes.ResultStatus, error)

Status returns the status of the HTTP Client

func (*TMClient) StopWebsocket

func (c *TMClient) StopWebsocket()

StopWebsocket stops the websocket connection

func (*TMClient) Subscribe

func (c *TMClient) Subscribe(event string) error

Subscribe to websocket channel

func (*TMClient) Unsubscribe

func (c *TMClient) Unsubscribe(event string) error

Unsubscribe from websocket channel

type TMStore

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

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

func New

func New(config *Config) *TMStore

New creates a new instance of a TMStore

func (*TMStore) AddDidSaveChannel

func (t *TMStore) AddDidSaveChannel(saveChan chan *cs.Segment)

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

func (*TMStore) DeleteSegment

func (t *TMStore) DeleteSegment(linkHash *types.Bytes32) (segment *cs.Segment, err error)

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

func (*TMStore) FindSegments

func (t *TMStore) FindSegments(filter *store.Filter) (segmentSlice cs.SegmentSlice, err error)

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

func (*TMStore) GetInfo

func (t *TMStore) GetInfo() (interface{}, error)

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

func (*TMStore) GetMapIDs

func (t *TMStore) GetMapIDs(pagination *store.Pagination) (ids []string, err error)

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

func (*TMStore) GetSegment

func (t *TMStore) GetSegment(linkHash *types.Bytes32) (segment *cs.Segment, err error)

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

func (*TMStore) RetryStartWebsocket

func (t *TMStore) RetryStartWebsocket(interval time.Duration) error

RetryStartWebsocket starts the websocket client and wait for New Block events, it retries on errors

func (*TMStore) SaveSegment

func (t *TMStore) SaveSegment(segment *cs.Segment) error

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

func (*TMStore) StartWebsocket

func (t *TMStore) StartWebsocket() error

StartWebsocket starts the websocket client and wait for New Block events

func (*TMStore) StopWebsocket

func (t *TMStore) StopWebsocket()

StopWebsocket stops the websocket client

Jump to

Keyboard shortcuts

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