Documentation ¶
Overview ¶
Package xenomint provides an eventual consistency implementation of the blockchain database.
Index ¶
- Variables
- type Chain
- type MuxLeaderCommitRequest
- type MuxLeaderCommitResponse
- type MuxQueryRequest
- type MuxQueryResponse
- type MuxService
- type QueryTracker
- type State
- func (s *State) Close(commit bool) (err error)
- func (s *State) CommitEx() (failed []*types.Request, queries []*QueryTracker, err error)
- func (s *State) CommitExWithContext(ctx context.Context) (failed []*types.Request, queries []*QueryTracker, err error)
- func (s *State) Query(req *types.Request, isLeader bool) (ref *QueryTracker, resp *types.Response, err error)
- func (s *State) QueryWithContext(ctx context.Context, req *types.Request, isLeader bool) (ref *QueryTracker, resp *types.Response, err error)
- func (s *State) Replay(req *types.Request, resp *types.Response) (err error)
- func (s *State) ReplayBlock(block *types.Block) (err error)
- func (s *State) ReplayBlockWithContext(ctx context.Context, block *types.Block) (err error)
- func (s *State) ReplayWithContext(ctx context.Context, req *types.Request, resp *types.Response) (err error)
- func (s *State) SetSeq(id uint64)
- func (s *State) Stat(id proto.DatabaseID)
Constants ¶
This section is empty.
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") )
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain defines the xenomint chain structure.
type MuxLeaderCommitRequest ¶
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 ¶
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 ¶
MuxQueryRequest defines a request of the Query RPC method.
type MuxQueryResponse ¶
MuxQueryResponse defines a response of the Query RPC method.
type MuxService ¶
type MuxService struct { ServiceName string // contains filtered or unexported fields }
MuxService defines multiplexing service of xenomint chain.
func NewMuxService ¶
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 ¶
func (s *MuxService) Query(req *MuxQueryRequest, resp *MuxQueryResponse) (err error)
Query is the RPC method to process database query on mux service.
type QueryTracker ¶
QueryTracker defines an object to track query as a request - response pair.
func (*QueryTracker) Ready ¶
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 ¶
func (q *QueryTracker) UpdateResp(resp *types.Response)
UpdateResp updates response of the QueryTracker within locking scope.
type State ¶
State defines a xenomint state which is bound to a underlying storage.
func (*State) Close ¶
Close commits any ongoing transaction if needed and closes the underlying storage.
func (*State) CommitEx ¶
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 ¶
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 ¶
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 ¶
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) ReplayBlock ¶
ReplayBlock replays the queries from block. It also checks and skips some preceding pooled queries.
func (*State) ReplayBlockWithContext ¶
ReplayBlockWithContext replays the queries from block with context. It also checks and skips some preceding pooled queries.
func (*State) ReplayWithContext ¶
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) Stat ¶
func (s *State) Stat(id proto.DatabaseID)
Stat prints the statistic message of the State object.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package interfaces defines common used interfaces of the xenomint package.
|
Package interfaces defines common used interfaces of the xenomint package. |
Package sqlite introduces a sqlite3 implementation of the xenomint/interfaces.Storage interface.
|
Package sqlite introduces a sqlite3 implementation of the xenomint/interfaces.Storage interface. |