CovenantSQL: github.com/CovenantSQL/CovenantSQL/xenomint Index | Files | Directories

package xenomint

import "github.com/CovenantSQL/CovenantSQL/xenomint"

Package xenomint provides an eventual consistency implementation of the blockchain database.

Index

Package Files

chain.go doc.go errors.go mux.go pool.go query_sanitizer.go state.go

Variables

var (
    // ErrMissingParent indicates the parent of the current query attempt is missing.
    ErrMissingParent = errors.New("query missing parent")
    // ErrInvalidRequest indicates the query is invalid.
    ErrInvalidRequest = errors.New("invalid request")
    // ErrQueryConflict indicates the there is a conflict on query replay.
    ErrQueryConflict = errors.New("query conflict")
    // ErrMuxServiceNotFound indicates that the multiplexing service endpoint is not found.
    ErrMuxServiceNotFound = errors.New("mux service not found")
    // ErrStatefulQueryParts indicates query contains stateful query parts.
    ErrStatefulQueryParts = errors.New("query contains stateful query parts")
    // ErrInvalidTableName indicates query contains invalid table name in ddl statement.
    ErrInvalidTableName = errors.New("invalid table name in ddl")
)

type Chain Uses

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

Chain defines the xenomint chain structure.

func NewChain Uses

func NewChain(filename string) (c *Chain, err error)

NewChain returns new chain instance.

func (*Chain) Query Uses

func (c *Chain) Query(req *types.Request) (resp *types.Response, err error)

Query queries req from local chain state and returns the query results in resp.

func (*Chain) Stop Uses

func (c *Chain) Stop() (err error)

Stop stops chain workers and RPC service.

type MuxLeaderCommitRequest Uses

type MuxLeaderCommitRequest struct {
    proto.DatabaseID
    proto.Envelope
    // Height is the expected block height of this commit.
    Height int32
}

MuxLeaderCommitRequest a request of the MuxLeaderCommitResponse RPC method.

type MuxLeaderCommitResponse Uses

type MuxLeaderCommitResponse struct {
    proto.DatabaseID
    proto.Envelope
    // Height is the expected block height of this commit.
    Height int32
    Offset uint64
}

MuxLeaderCommitResponse a response of the MuxLeaderCommitResponse RPC method.

type MuxQueryRequest Uses

type MuxQueryRequest struct {
    proto.DatabaseID
    proto.Envelope
    Request *types.Request
}

MuxQueryRequest defines a request of the Query RPC method.

type MuxQueryResponse Uses

type MuxQueryResponse struct {
    proto.DatabaseID
    proto.Envelope
    Response *types.Response
}

MuxQueryResponse defines a response of the Query RPC method.

type MuxService Uses

type MuxService struct {
    ServiceName string
    // contains filtered or unexported fields
}

MuxService defines multiplexing service of xenomint chain.

func NewMuxService Uses

func NewMuxService(name string, server *rpc.Server) (service *MuxService, err error)

NewMuxService returns a new MuxService instance and registers it to server.

func (*MuxService) Query Uses

func (s *MuxService) Query(req *MuxQueryRequest, resp *MuxQueryResponse) (err error)

Query is the RPC method to process database query on mux service.

type QueryTracker Uses

type QueryTracker struct {
    sync.RWMutex
    Req  *types.Request
    Resp *types.Response
}

QueryTracker defines an object to track query as a request - response pair.

func (*QueryTracker) Ready Uses

func (q *QueryTracker) Ready() bool

Ready reports whether the query is ready for block producing. It is assumed that all objects should be ready shortly.

func (*QueryTracker) UpdateResp Uses

func (q *QueryTracker) UpdateResp(resp *types.Response)

UpdateResp updates response of the QueryTracker within locking scope.

type State Uses

type State struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

State defines a xenomint state which is bound to a underlying storage.

func NewState Uses

func NewState(level sql.IsolationLevel, nodeID proto.NodeID, strg xi.Storage) (s *State)

NewState returns a new State bound to strg.

func (*State) Close Uses

func (s *State) Close(commit bool) (err error)

Close commits any ongoing transaction if needed and closes the underlying storage.

func (*State) CommitEx Uses

func (s *State) CommitEx() (failed []*types.Request, queries []*QueryTracker, err error)

CommitEx commits the current transaction and returns all the pooled queries.

func (*State) CommitExWithContext Uses

func (s *State) CommitExWithContext(
    ctx context.Context) (failed []*types.Request, queries []*QueryTracker, err error,
)

CommitExWithContext commits the current transaction and returns all the pooled queries with context.

func (*State) Query Uses

func (s *State) Query(req *types.Request, isLeader bool) (ref *QueryTracker, resp *types.Response, err error)

Query does the query(ies) in req, pools the request and persists any change to the underlying storage.

func (*State) QueryWithContext Uses

func (s *State) QueryWithContext(
    ctx context.Context, req *types.Request, isLeader bool) (ref *QueryTracker, resp *types.Response, err error,
)

QueryWithContext does the query(ies) in req, pools the request and persists any change to the underlying storage.

func (*State) Replay Uses

func (s *State) Replay(req *types.Request, resp *types.Response) (err error)

Replay replays a write log from other peer to replicate storage state.

func (*State) ReplayBlock Uses

func (s *State) ReplayBlock(block *types.Block) (err error)

ReplayBlock replays the queries from block. It also checks and skips some preceding pooled queries.

func (*State) ReplayBlockWithContext Uses

func (s *State) ReplayBlockWithContext(ctx context.Context, block *types.Block) (err error)

ReplayBlockWithContext replays the queries from block with context. It also checks and skips some preceding pooled queries.

func (*State) ReplayWithContext Uses

func (s *State) ReplayWithContext(
    ctx context.Context, req *types.Request, resp *types.Response) (err error,
)

ReplayWithContext replays a write log from other peer to replicate storage state with context.

func (*State) SetSeq Uses

func (s *State) SetSeq(id uint64)

SetSeq sets the initial id of the current transaction.

func (*State) Stat Uses

func (s *State) Stat(id proto.DatabaseID)

Stat prints the statistic message of the State object.

Directories

PathSynopsis
interfacesPackage interfaces defines common used interfaces of the xenomint package.
sqlitePackage sqlite introduces a sqlite3 implementation of the xenomint/interfaces.Storage interface.
types

Package xenomint imports 20 packages (graph) and is imported by 6 packages. Updated 2019-06-10. Refresh now. Tools for package owners.