Documentation
¶
Index ¶
- Variables
- func ID(data []byte) uint32
- func MakeTraceID(trace *Trace) ([]byte, error)
- func MakeTransactionID(top []TraceObjectPair) ([]byte, error)
- func NewPendingEvents(cb func(Event) bool) *pendingEvents
- type Action
- type AddTransactionRequest
- func (*AddTransactionRequest) Descriptor() ([]byte, []int)
- func (m *AddTransactionRequest) GetEvidences() map[uint64][]byte
- func (m *AddTransactionRequest) GetTx() *Transaction
- func (*AddTransactionRequest) ProtoMessage()
- func (m *AddTransactionRequest) Reset()
- func (m *AddTransactionRequest) String() string
- func (m *AddTransactionRequest) XXX_DiscardUnknown()
- func (m *AddTransactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *AddTransactionRequest) XXX_Merge(src proto.Message)
- func (m *AddTransactionRequest) XXX_Size() int
- func (m *AddTransactionRequest) XXX_Unmarshal(b []byte) error
- type AddTransactionResponse
- func (*AddTransactionResponse) Descriptor() ([]byte, []int)
- func (m *AddTransactionResponse) GetObjects() []*Object
- func (*AddTransactionResponse) ProtoMessage()
- func (m *AddTransactionResponse) Reset()
- func (m *AddTransactionResponse) String() string
- func (m *AddTransactionResponse) XXX_DiscardUnknown()
- func (m *AddTransactionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *AddTransactionResponse) XXX_Merge(src proto.Message)
- func (m *AddTransactionResponse) XXX_Size() int
- func (m *AddTransactionResponse) XXX_Unmarshal(b []byte) error
- type BadgerStore
- func (s *BadgerStore) AddTransaction(txkey []byte, value []byte) error
- func (s *BadgerStore) Close() error
- func (s *BadgerStore) CommitTransaction(txnkey []byte, inobjkeys [][]byte, objs []*Object) error
- func (s *BadgerStore) CreateObject(vid, value []byte) (*Object, error)
- func (s *BadgerStore) CreateObjects(objs []*Object) error
- func (s *BadgerStore) DeactivateObjects(keys [][]byte) error
- func (s *BadgerStore) DeleteObjects(objkeys [][]byte) error
- func (s *BadgerStore) FinishTransaction(txnkey []byte) error
- func (s *BadgerStore) GetObjects(vids [][]byte) ([]*Object, error)
- func (s *BadgerStore) GetTransaction(txkey []byte) ([]byte, bool, error)
- func (s *BadgerStore) LockObjects(objkeys [][]byte) error
- func (s *BadgerStore) TxnFinished(txnkey []byte) (bool, error)
- func (s *BadgerStore) UnlockObjects(objkeys [][]byte) error
- type Config
- type ConsensusEvent
- type ConsensusEventAction
- type ConsensusOp
- type ConsensusStateMachine
- type ConsensusTransaction
- func (*ConsensusTransaction) Descriptor() ([]byte, []int)
- func (m *ConsensusTransaction) GetEvidences() map[uint64][]byte
- func (m *ConsensusTransaction) GetInitiator() uint64
- func (m *ConsensusTransaction) GetOp() ConsensusOp
- func (m *ConsensusTransaction) GetTx() *Transaction
- func (m *ConsensusTransaction) GetTxID() []byte
- func (*ConsensusTransaction) ProtoMessage()
- func (m *ConsensusTransaction) Reset()
- func (m *ConsensusTransaction) String() string
- func (m *ConsensusTransaction) XXX_DiscardUnknown()
- func (m *ConsensusTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *ConsensusTransaction) XXX_Merge(src proto.Message)
- func (m *ConsensusTransaction) XXX_Size() int
- func (m *ConsensusTransaction) XXX_Unmarshal(b []byte) error
- type CreateObjectRequest
- func (*CreateObjectRequest) Descriptor() ([]byte, []int)
- func (m *CreateObjectRequest) GetObject() []byte
- func (*CreateObjectRequest) ProtoMessage()
- func (m *CreateObjectRequest) Reset()
- func (m *CreateObjectRequest) String() string
- func (m *CreateObjectRequest) XXX_DiscardUnknown()
- func (m *CreateObjectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *CreateObjectRequest) XXX_Merge(src proto.Message)
- func (m *CreateObjectRequest) XXX_Size() int
- func (m *CreateObjectRequest) XXX_Unmarshal(b []byte) error
- type CreateObjectResponse
- func (*CreateObjectResponse) Descriptor() ([]byte, []int)
- func (m *CreateObjectResponse) GetError() string
- func (m *CreateObjectResponse) GetID() []byte
- func (*CreateObjectResponse) ProtoMessage()
- func (m *CreateObjectResponse) Reset()
- func (m *CreateObjectResponse) String() string
- func (m *CreateObjectResponse) XXX_DiscardUnknown()
- func (m *CreateObjectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *CreateObjectResponse) XXX_Merge(src proto.Message)
- func (m *CreateObjectResponse) XXX_Size() int
- func (m *CreateObjectResponse) XXX_Unmarshal(b []byte) error
- type CreateObjectsRequest
- func (*CreateObjectsRequest) Descriptor() ([]byte, []int)
- func (m *CreateObjectsRequest) GetObjects() [][]byte
- func (*CreateObjectsRequest) ProtoMessage()
- func (m *CreateObjectsRequest) Reset()
- func (m *CreateObjectsRequest) String() string
- func (m *CreateObjectsRequest) XXX_DiscardUnknown()
- func (m *CreateObjectsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *CreateObjectsRequest) XXX_Merge(src proto.Message)
- func (m *CreateObjectsRequest) XXX_Size() int
- func (m *CreateObjectsRequest) XXX_Unmarshal(b []byte) error
- type CreateObjectsResponse
- func (*CreateObjectsResponse) Descriptor() ([]byte, []int)
- func (m *CreateObjectsResponse) GetError() string
- func (m *CreateObjectsResponse) GetIDs() [][]byte
- func (*CreateObjectsResponse) ProtoMessage()
- func (m *CreateObjectsResponse) Reset()
- func (m *CreateObjectsResponse) String() string
- func (m *CreateObjectsResponse) XXX_DiscardUnknown()
- func (m *CreateObjectsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *CreateObjectsResponse) XXX_Merge(src proto.Message)
- func (m *CreateObjectsResponse) XXX_Size() int
- func (m *CreateObjectsResponse) XXX_Unmarshal(b []byte) error
- type DetailTx
- type Event
- type EventKind
- type IDs
- type Object
- func (*Object) Descriptor() ([]byte, []int)
- func (m *Object) GetLabels() []string
- func (m *Object) GetStatus() ObjectStatus
- func (m *Object) GetValue() []byte
- func (m *Object) GetVersionID() []byte
- func (*Object) ProtoMessage()
- func (m *Object) Reset()
- func (m *Object) String() string
- func (m *Object) XXX_DiscardUnknown()
- func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Object) XXX_Merge(src proto.Message)
- func (m *Object) XXX_Size() int
- func (m *Object) XXX_Unmarshal(b []byte) error
- type ObjectList
- func (*ObjectList) Descriptor() ([]byte, []int)
- func (m *ObjectList) GetList() []*Object
- func (*ObjectList) ProtoMessage()
- func (m *ObjectList) Reset()
- func (m *ObjectList) String() string
- func (m *ObjectList) XXX_DiscardUnknown()
- func (m *ObjectList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *ObjectList) XXX_Merge(src proto.Message)
- func (m *ObjectList) XXX_Size() int
- func (m *ObjectList) XXX_Unmarshal(b []byte) error
- type ObjectStatus
- type ObjectTraceIDPair
- func (*ObjectTraceIDPair) Descriptor() ([]byte, []int)
- func (m *ObjectTraceIDPair) GetObjects() []*Object
- func (m *ObjectTraceIDPair) GetTraceID() []byte
- func (*ObjectTraceIDPair) ProtoMessage()
- func (m *ObjectTraceIDPair) Reset()
- func (m *ObjectTraceIDPair) String() string
- func (m *ObjectTraceIDPair) XXX_DiscardUnknown()
- func (m *ObjectTraceIDPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *ObjectTraceIDPair) XXX_Merge(src proto.Message)
- func (m *ObjectTraceIDPair) XXX_Size() int
- func (m *ObjectTraceIDPair) XXX_Unmarshal(b []byte) error
- type Opcode
- type OutputObject
- func (*OutputObject) Descriptor() ([]byte, []int)
- func (m *OutputObject) GetLabels() []string
- func (m *OutputObject) GetObject() []byte
- func (*OutputObject) ProtoMessage()
- func (m *OutputObject) Reset()
- func (m *OutputObject) String() string
- func (m *OutputObject) XXX_DiscardUnknown()
- func (m *OutputObject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *OutputObject) XXX_Merge(src proto.Message)
- func (m *OutputObject) XXX_Size() int
- func (m *OutputObject) XXX_Unmarshal(b []byte) error
- type QueryObjectRequest
- func (*QueryObjectRequest) Descriptor() ([]byte, []int)
- func (m *QueryObjectRequest) GetVersionID() []byte
- func (*QueryObjectRequest) ProtoMessage()
- func (m *QueryObjectRequest) Reset()
- func (m *QueryObjectRequest) String() string
- func (m *QueryObjectRequest) XXX_DiscardUnknown()
- func (m *QueryObjectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *QueryObjectRequest) XXX_Merge(src proto.Message)
- func (m *QueryObjectRequest) XXX_Size() int
- func (m *QueryObjectRequest) XXX_Unmarshal(b []byte) error
- type QueryObjectResponse
- func (*QueryObjectResponse) Descriptor() ([]byte, []int)
- func (m *QueryObjectResponse) GetError() string
- func (m *QueryObjectResponse) GetObject() *Object
- func (*QueryObjectResponse) ProtoMessage()
- func (m *QueryObjectResponse) Reset()
- func (m *QueryObjectResponse) String() string
- func (m *QueryObjectResponse) XXX_DiscardUnknown()
- func (m *QueryObjectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *QueryObjectResponse) XXX_Merge(src proto.Message)
- func (m *QueryObjectResponse) XXX_Size() int
- func (m *QueryObjectResponse) XXX_Unmarshal(b []byte) error
- type SBACDecision
- type SBACEvent
- type SBACEventAction
- type SBACMessage
- func (*SBACMessage) Descriptor() ([]byte, []int)
- func (m *SBACMessage) GetDecision() SBACDecision
- func (m *SBACMessage) GetEvidences() map[uint64][]byte
- func (m *SBACMessage) GetOp() SBACOp
- func (m *SBACMessage) GetPeerID() uint64
- func (m *SBACMessage) GetSignature() []byte
- func (m *SBACMessage) GetTx() *Transaction
- func (m *SBACMessage) GetTxID() []byte
- func (*SBACMessage) ProtoMessage()
- func (m *SBACMessage) Reset()
- func (m *SBACMessage) String() string
- func (m *SBACMessage) XXX_DiscardUnknown()
- func (m *SBACMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SBACMessage) XXX_Merge(src proto.Message)
- func (m *SBACMessage) XXX_Size() int
- func (m *SBACMessage) XXX_Unmarshal(b []byte) error
- type SBACMessageAck
- func (*SBACMessageAck) Descriptor() ([]byte, []int)
- func (m *SBACMessageAck) GetLastID() uint64
- func (*SBACMessageAck) ProtoMessage()
- func (m *SBACMessageAck) Reset()
- func (m *SBACMessageAck) String() string
- func (m *SBACMessageAck) XXX_DiscardUnknown()
- func (m *SBACMessageAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *SBACMessageAck) XXX_Merge(src proto.Message)
- func (m *SBACMessageAck) XXX_Size() int
- func (m *SBACMessageAck) XXX_Unmarshal(b []byte) error
- type SBACOp
- type SBACStateMachine
- type Service
- type ServiceSBAC
- func (s *ServiceSBAC) AddTransaction(ctx context.Context, tx *Transaction, evidences map[uint64][]byte) ([]*Object, error)
- func (s *ServiceSBAC) Handle(peerID uint64, m *service.Message) (*service.Message, error)
- func (s *ServiceSBAC) Name() string
- func (s *ServiceSBAC) QueryObjectByVersionID(versionid []byte) ([]byte, error)
- func (s *ServiceSBAC) StatesReport(ctx context.Context) *StatesReportResponse
- func (s *ServiceSBAC) Stop() error
- type SignedDecision
- type State
- type StateConsensus
- type StateMachine
- type StateMachineConfig
- type StateMachineScheduler
- func (s *StateMachineScheduler) Add(detail *DetailTx, initialState State) *StateMachine
- func (s *StateMachineScheduler) Get(txID []byte) (*StateMachine, bool)
- func (s *StateMachineScheduler) GetOrCreate(detail *DetailTx, initialState State) *StateMachine
- func (s *StateMachineScheduler) RunGC()
- func (s *StateMachineScheduler) StatesReport() []*StateReport
- type StateReport
- func (*StateReport) Descriptor() ([]byte, []int)
- func (m *StateReport) GetCommitDecisions() map[uint64]bool
- func (m *StateReport) GetHashID() uint32
- func (m *StateReport) GetPendingEvents() int32
- func (m *StateReport) GetPhase1Decisions() map[uint64]bool
- func (m *StateReport) GetPhase2Decisions() map[uint64]bool
- func (m *StateReport) GetState() string
- func (*StateReport) ProtoMessage()
- func (m *StateReport) Reset()
- func (m *StateReport) String() string
- func (m *StateReport) XXX_DiscardUnknown()
- func (m *StateReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *StateReport) XXX_Merge(src proto.Message)
- func (m *StateReport) XXX_Size() int
- func (m *StateReport) XXX_Unmarshal(b []byte) error
- type StateSBAC
- type StateTable
- type StateTransition
- type States
- type StatesReportResponse
- func (*StatesReportResponse) Descriptor() ([]byte, []int)
- func (m *StatesReportResponse) GetEventsInQueue() int32
- func (m *StatesReportResponse) GetStates() []*StateReport
- func (*StatesReportResponse) ProtoMessage()
- func (m *StatesReportResponse) Reset()
- func (m *StatesReportResponse) String() string
- func (m *StatesReportResponse) XXX_DiscardUnknown()
- func (m *StatesReportResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *StatesReportResponse) XXX_Merge(src proto.Message)
- func (m *StatesReportResponse) XXX_Size() int
- func (m *StatesReportResponse) XXX_Unmarshal(b []byte) error
- type Store
- type Trace
- func (*Trace) Descriptor() ([]byte, []int)
- func (m *Trace) GetContractID() string
- func (m *Trace) GetDependencies() []*Trace
- func (m *Trace) GetInputObjectVersionIDs() [][]byte
- func (m *Trace) GetInputObjects() [][]byte
- func (m *Trace) GetInputReferenceVersionIDs() [][]byte
- func (m *Trace) GetInputReferences() [][]byte
- func (m *Trace) GetOutputObjects() []*OutputObject
- func (m *Trace) GetParameters() [][]byte
- func (m *Trace) GetProcedure() string
- func (m *Trace) GetReturns() [][]byte
- func (*Trace) ProtoMessage()
- func (m *Trace) Reset()
- func (m *Trace) String() string
- func (m *Trace) XXX_DiscardUnknown()
- func (m *Trace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Trace) XXX_Merge(src proto.Message)
- func (m *Trace) XXX_Size() int
- func (m *Trace) XXX_Unmarshal(b []byte) error
- type TraceIdentifierPair
- type TraceObjectPair
- type Transaction
- func (*Transaction) Descriptor() ([]byte, []int)
- func (m *Transaction) GetTraces() []*Trace
- func (*Transaction) ProtoMessage()
- func (m *Transaction) Reset()
- func (m *Transaction) String() string
- func (m *Transaction) XXX_DiscardUnknown()
- func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Transaction) XXX_Merge(src proto.Message)
- func (m *Transaction) XXX_Size() int
- func (m *Transaction) XXX_Unmarshal(b []byte) error
- type Transition
Constants ¶
This section is empty.
Variables ¶
var ( ErrTransactionAlreadyExists = errors.New("Transaction already exists") ErrTransactionAlreadyCommitted = errors.New("Transaction already committed") ErrObjectAlreadyExists = errors.New("Output object already exists") ErrObjectAlreadyInactive = errors.New("Object already in INACTIVE state") ErrObjectCannotBeLocked = errors.New("Object cannot be locked (already INACTIVE or LOCKED)") ErrObjectCannotBeUnlocked = errors.New("Object cannot be unlocked") )
var ConsensusOp_name = map[int32]string{
0: "Consensus1",
1: "Consensus2",
2: "ConsensusCommit",
}
var ConsensusOp_value = map[string]int32{
"Consensus1": 0,
"Consensus2": 1,
"ConsensusCommit": 2,
}
var ObjectStatus_name = map[int32]string{
0: "ACTIVE",
1: "INACTIVE",
2: "LOCKED",
}
var ObjectStatus_value = map[string]int32{
"ACTIVE": 0,
"INACTIVE": 1,
"LOCKED": 2,
}
var Opcode_name = map[int32]string{
0: "UNKNOWN",
1: "ADD_TRANSACTION",
2: "QUERY_OBJECT",
3: "CREATE_OBJECT",
4: "STATES",
5: "SBAC",
6: "CREATE_OBJECTS",
}
var Opcode_value = map[string]int32{
"UNKNOWN": 0,
"ADD_TRANSACTION": 1,
"QUERY_OBJECT": 2,
"CREATE_OBJECT": 3,
"STATES": 4,
"SBAC": 5,
"CREATE_OBJECTS": 6,
}
var SBACDecision_name = map[int32]string{
0: "ACCEPT",
1: "REJECT",
}
var SBACDecision_value = map[string]int32{
"ACCEPT": 0,
"REJECT": 1,
}
var SBACOp_name = map[int32]string{
0: "Phase1",
1: "Phase2",
2: "Commit",
}
var SBACOp_value = map[string]int32{
"Phase1": 0,
"Phase2": 1,
"Commit": 2,
}
Functions ¶
func MakeTraceID ¶
MakeTraceID generate an identifier for the given trace the ID is composed of: the contract ID, the procedure, input objects keys, input reference keys, trace ID of the dependencies
func MakeTransactionID ¶
func MakeTransactionID(top []TraceObjectPair) ([]byte, error)
func NewPendingEvents ¶
Types ¶
type Action ¶
Action specify an action to execute when a new event is triggered. it returns a State, which will be either the new actual state, the next state which may required a transition from the current state to the new one (see the transition table
type AddTransactionRequest ¶
type AddTransactionRequest struct { Tx *Transaction `protobuf:"bytes,1,opt,name=tx" json:"tx,omitempty"` Evidences map[uint64][]byte `` /* 153-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*AddTransactionRequest) Descriptor ¶
func (*AddTransactionRequest) Descriptor() ([]byte, []int)
func (*AddTransactionRequest) GetEvidences ¶
func (m *AddTransactionRequest) GetEvidences() map[uint64][]byte
func (*AddTransactionRequest) GetTx ¶
func (m *AddTransactionRequest) GetTx() *Transaction
func (*AddTransactionRequest) ProtoMessage ¶
func (*AddTransactionRequest) ProtoMessage()
func (*AddTransactionRequest) Reset ¶
func (m *AddTransactionRequest) Reset()
func (*AddTransactionRequest) String ¶
func (m *AddTransactionRequest) String() string
func (*AddTransactionRequest) XXX_DiscardUnknown ¶
func (m *AddTransactionRequest) XXX_DiscardUnknown()
func (*AddTransactionRequest) XXX_Marshal ¶
func (m *AddTransactionRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AddTransactionRequest) XXX_Merge ¶
func (dst *AddTransactionRequest) XXX_Merge(src proto.Message)
func (*AddTransactionRequest) XXX_Size ¶
func (m *AddTransactionRequest) XXX_Size() int
func (*AddTransactionRequest) XXX_Unmarshal ¶
func (m *AddTransactionRequest) XXX_Unmarshal(b []byte) error
type AddTransactionResponse ¶
type AddTransactionResponse struct { Objects []*Object `protobuf:"bytes,1,rep,name=objects" json:"objects,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*AddTransactionResponse) Descriptor ¶
func (*AddTransactionResponse) Descriptor() ([]byte, []int)
func (*AddTransactionResponse) GetObjects ¶
func (m *AddTransactionResponse) GetObjects() []*Object
func (*AddTransactionResponse) ProtoMessage ¶
func (*AddTransactionResponse) ProtoMessage()
func (*AddTransactionResponse) Reset ¶
func (m *AddTransactionResponse) Reset()
func (*AddTransactionResponse) String ¶
func (m *AddTransactionResponse) String() string
func (*AddTransactionResponse) XXX_DiscardUnknown ¶
func (m *AddTransactionResponse) XXX_DiscardUnknown()
func (*AddTransactionResponse) XXX_Marshal ¶
func (m *AddTransactionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AddTransactionResponse) XXX_Merge ¶
func (dst *AddTransactionResponse) XXX_Merge(src proto.Message)
func (*AddTransactionResponse) XXX_Size ¶
func (m *AddTransactionResponse) XXX_Size() int
func (*AddTransactionResponse) XXX_Unmarshal ¶
func (m *AddTransactionResponse) XXX_Unmarshal(b []byte) error
type BadgerStore ¶
type BadgerStore struct {
// contains filtered or unexported fields
}
func NewBadgerStore ¶
func NewBadgerStore(rootDir string) (*BadgerStore, error)
func (*BadgerStore) AddTransaction ¶
func (s *BadgerStore) AddTransaction(txkey []byte, value []byte) error
AddTransaction create a new entry for the transaction seen by this node. This also create a new entry for the committed transaction set to false
func (*BadgerStore) Close ¶
func (s *BadgerStore) Close() error
func (*BadgerStore) CommitTransaction ¶
func (s *BadgerStore) CommitTransaction( txnkey []byte, inobjkeys [][]byte, objs []*Object) error
CommitTransaction will in the same transaction move all object from their current state to inactive, creates output objects, then update the transaction commit status. if any operation is not possible, everything is rollback and an error is returned.
func (*BadgerStore) CreateObject ¶
func (s *BadgerStore) CreateObject(vid, value []byte) (*Object, error)
testing purpose only, allow us to create an new object in the node without consensus in a completely arbitrary way
func (*BadgerStore) CreateObjects ¶
func (s *BadgerStore) CreateObjects(objs []*Object) error
CreateObjects
func (*BadgerStore) DeactivateObjects ¶
func (s *BadgerStore) DeactivateObjects(keys [][]byte) error
DeactivateObjects set to inactive all objects in the list this will return an error if one+ objects are already inactive
func (*BadgerStore) DeleteObjects ¶
func (s *BadgerStore) DeleteObjects(objkeys [][]byte) error
testing purpose only, allow us to delete an object in the node without consensus in a completely arbitrary way
func (*BadgerStore) FinishTransaction ¶
func (s *BadgerStore) FinishTransaction(txnkey []byte) error
func (*BadgerStore) GetObjects ¶
func (s *BadgerStore) GetObjects(vids [][]byte) ([]*Object, error)
GetObjectsFromStore return the list of objects corresponding to the list of versionIDs order the same. if any of the keys do not match in database an error is returned
func (*BadgerStore) GetTransaction ¶
func (s *BadgerStore) GetTransaction(txkey []byte) ([]byte, bool, error)
GetTransaction return a transaction stored in database matching the given key. if the transaction key do not exists an error is returned returns the value of the transction, and if the transaction is committed or not as a boolean
func (*BadgerStore) LockObjects ¶
func (s *BadgerStore) LockObjects(objkeys [][]byte) error
LockObjects perform a lock on all the objects from the keys slice. If one+ object is already locked or inactive this action is rolled back and an error is returned
func (*BadgerStore) TxnFinished ¶
func (s *BadgerStore) TxnFinished(txnkey []byte) (bool, error)
func (*BadgerStore) UnlockObjects ¶
func (s *BadgerStore) UnlockObjects(objkeys [][]byte) error
UnlockObject unlock all object coresponding to the objects keys. If one+ object is inactive all operations are rolled back and an error is returned
type ConsensusEvent ¶
type ConsensusEvent struct {
// contains filtered or unexported fields
}
func NewConsensusEvent ¶
func NewConsensusEvent(data *ConsensusTransaction) *ConsensusEvent
func (*ConsensusEvent) Kind ¶
func (e *ConsensusEvent) Kind() EventKind
func (*ConsensusEvent) PeerID ¶
func (e *ConsensusEvent) PeerID() uint64
func (*ConsensusEvent) TxID ¶
func (e *ConsensusEvent) TxID() []byte
type ConsensusEventAction ¶
type ConsensusEventAction func(st *States, e *ConsensusEvent) (StateConsensus, error)
type ConsensusOp ¶
type ConsensusOp int32
const ( ConsensusOp_Consensus1 ConsensusOp = 0 ConsensusOp_Consensus2 ConsensusOp = 1 ConsensusOp_ConsensusCommit ConsensusOp = 2 )
func (ConsensusOp) EnumDescriptor ¶
func (ConsensusOp) EnumDescriptor() ([]byte, []int)
func (ConsensusOp) String ¶
func (x ConsensusOp) String() string
type ConsensusStateMachine ¶
type ConsensusStateMachine struct {
// contains filtered or unexported fields
}
func NewConsensuStateMachine ¶
func NewConsensuStateMachine(phase ConsensusOp, action ConsensusEventAction) *ConsensusStateMachine
func (*ConsensusStateMachine) Data ¶
func (c *ConsensusStateMachine) Data() interface{}
func (*ConsensusStateMachine) Phase ¶
func (c *ConsensusStateMachine) Phase() ConsensusOp
func (*ConsensusStateMachine) State ¶
func (c *ConsensusStateMachine) State() StateConsensus
type ConsensusTransaction ¶
type ConsensusTransaction struct { TxID []byte `protobuf:"bytes,1,opt,name=txId,proto3" json:"txId,omitempty"` Tx *Transaction `protobuf:"bytes,2,opt,name=tx" json:"tx,omitempty"` Evidences map[uint64][]byte `` /* 153-byte string literal not displayed */ Op ConsensusOp `protobuf:"varint,4,opt,name=op,proto3,enum=sbac.ConsensusOp" json:"op,omitempty"` Initiator uint64 `protobuf:"varint,5,opt,name=initiator,proto3" json:"initiator,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ConsensusTransaction) Descriptor ¶
func (*ConsensusTransaction) Descriptor() ([]byte, []int)
func (*ConsensusTransaction) GetEvidences ¶
func (m *ConsensusTransaction) GetEvidences() map[uint64][]byte
func (*ConsensusTransaction) GetInitiator ¶
func (m *ConsensusTransaction) GetInitiator() uint64
func (*ConsensusTransaction) GetOp ¶
func (m *ConsensusTransaction) GetOp() ConsensusOp
func (*ConsensusTransaction) GetTx ¶
func (m *ConsensusTransaction) GetTx() *Transaction
func (*ConsensusTransaction) GetTxID ¶
func (m *ConsensusTransaction) GetTxID() []byte
func (*ConsensusTransaction) ProtoMessage ¶
func (*ConsensusTransaction) ProtoMessage()
func (*ConsensusTransaction) Reset ¶
func (m *ConsensusTransaction) Reset()
func (*ConsensusTransaction) String ¶
func (m *ConsensusTransaction) String() string
func (*ConsensusTransaction) XXX_DiscardUnknown ¶
func (m *ConsensusTransaction) XXX_DiscardUnknown()
func (*ConsensusTransaction) XXX_Marshal ¶
func (m *ConsensusTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ConsensusTransaction) XXX_Merge ¶
func (dst *ConsensusTransaction) XXX_Merge(src proto.Message)
func (*ConsensusTransaction) XXX_Size ¶
func (m *ConsensusTransaction) XXX_Size() int
func (*ConsensusTransaction) XXX_Unmarshal ¶
func (m *ConsensusTransaction) XXX_Unmarshal(b []byte) error
type CreateObjectRequest ¶
type CreateObjectRequest struct { Object []byte `protobuf:"bytes,1,opt,name=object,proto3" json:"object,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CreateObjectRequest) Descriptor ¶
func (*CreateObjectRequest) Descriptor() ([]byte, []int)
func (*CreateObjectRequest) GetObject ¶
func (m *CreateObjectRequest) GetObject() []byte
func (*CreateObjectRequest) ProtoMessage ¶
func (*CreateObjectRequest) ProtoMessage()
func (*CreateObjectRequest) Reset ¶
func (m *CreateObjectRequest) Reset()
func (*CreateObjectRequest) String ¶
func (m *CreateObjectRequest) String() string
func (*CreateObjectRequest) XXX_DiscardUnknown ¶
func (m *CreateObjectRequest) XXX_DiscardUnknown()
func (*CreateObjectRequest) XXX_Marshal ¶
func (m *CreateObjectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateObjectRequest) XXX_Merge ¶
func (dst *CreateObjectRequest) XXX_Merge(src proto.Message)
func (*CreateObjectRequest) XXX_Size ¶
func (m *CreateObjectRequest) XXX_Size() int
func (*CreateObjectRequest) XXX_Unmarshal ¶
func (m *CreateObjectRequest) XXX_Unmarshal(b []byte) error
type CreateObjectResponse ¶
type CreateObjectResponse struct { ID []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CreateObjectResponse) Descriptor ¶
func (*CreateObjectResponse) Descriptor() ([]byte, []int)
func (*CreateObjectResponse) GetError ¶
func (m *CreateObjectResponse) GetError() string
func (*CreateObjectResponse) GetID ¶
func (m *CreateObjectResponse) GetID() []byte
func (*CreateObjectResponse) ProtoMessage ¶
func (*CreateObjectResponse) ProtoMessage()
func (*CreateObjectResponse) Reset ¶
func (m *CreateObjectResponse) Reset()
func (*CreateObjectResponse) String ¶
func (m *CreateObjectResponse) String() string
func (*CreateObjectResponse) XXX_DiscardUnknown ¶
func (m *CreateObjectResponse) XXX_DiscardUnknown()
func (*CreateObjectResponse) XXX_Marshal ¶
func (m *CreateObjectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateObjectResponse) XXX_Merge ¶
func (dst *CreateObjectResponse) XXX_Merge(src proto.Message)
func (*CreateObjectResponse) XXX_Size ¶
func (m *CreateObjectResponse) XXX_Size() int
func (*CreateObjectResponse) XXX_Unmarshal ¶
func (m *CreateObjectResponse) XXX_Unmarshal(b []byte) error
type CreateObjectsRequest ¶
type CreateObjectsRequest struct { Objects [][]byte `protobuf:"bytes,1,rep,name=objects" json:"objects,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CreateObjectsRequest) Descriptor ¶
func (*CreateObjectsRequest) Descriptor() ([]byte, []int)
func (*CreateObjectsRequest) GetObjects ¶
func (m *CreateObjectsRequest) GetObjects() [][]byte
func (*CreateObjectsRequest) ProtoMessage ¶
func (*CreateObjectsRequest) ProtoMessage()
func (*CreateObjectsRequest) Reset ¶
func (m *CreateObjectsRequest) Reset()
func (*CreateObjectsRequest) String ¶
func (m *CreateObjectsRequest) String() string
func (*CreateObjectsRequest) XXX_DiscardUnknown ¶
func (m *CreateObjectsRequest) XXX_DiscardUnknown()
func (*CreateObjectsRequest) XXX_Marshal ¶
func (m *CreateObjectsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateObjectsRequest) XXX_Merge ¶
func (dst *CreateObjectsRequest) XXX_Merge(src proto.Message)
func (*CreateObjectsRequest) XXX_Size ¶
func (m *CreateObjectsRequest) XXX_Size() int
func (*CreateObjectsRequest) XXX_Unmarshal ¶
func (m *CreateObjectsRequest) XXX_Unmarshal(b []byte) error
type CreateObjectsResponse ¶
type CreateObjectsResponse struct { IDs [][]byte `protobuf:"bytes,1,rep,name=ids" json:"ids,omitempty"` Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*CreateObjectsResponse) Descriptor ¶
func (*CreateObjectsResponse) Descriptor() ([]byte, []int)
func (*CreateObjectsResponse) GetError ¶
func (m *CreateObjectsResponse) GetError() string
func (*CreateObjectsResponse) GetIDs ¶
func (m *CreateObjectsResponse) GetIDs() [][]byte
func (*CreateObjectsResponse) ProtoMessage ¶
func (*CreateObjectsResponse) ProtoMessage()
func (*CreateObjectsResponse) Reset ¶
func (m *CreateObjectsResponse) Reset()
func (*CreateObjectsResponse) String ¶
func (m *CreateObjectsResponse) String() string
func (*CreateObjectsResponse) XXX_DiscardUnknown ¶
func (m *CreateObjectsResponse) XXX_DiscardUnknown()
func (*CreateObjectsResponse) XXX_Marshal ¶
func (m *CreateObjectsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*CreateObjectsResponse) XXX_Merge ¶
func (dst *CreateObjectsResponse) XXX_Merge(src proto.Message)
func (*CreateObjectsResponse) XXX_Size ¶
func (m *CreateObjectsResponse) XXX_Size() int
func (*CreateObjectsResponse) XXX_Unmarshal ¶
func (m *CreateObjectsResponse) XXX_Unmarshal(b []byte) error
type Event ¶
func NewSBACEvent ¶
func NewSBACEvent(data *SBACMessage) Event
type IDs ¶
type IDs struct { TxID []byte TraceObjectPairs []TraceObjectPair }
func MakeIDs ¶
func MakeIDs(tx *Transaction) (*IDs, error)
type Object ¶
type Object struct { VersionID []byte `protobuf:"bytes,1,opt,name=versionID,proto3" json:"versionID,omitempty"` Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` Status ObjectStatus `protobuf:"varint,3,opt,name=status,proto3,enum=sbac.ObjectStatus" json:"status,omitempty"` Labels []string `protobuf:"bytes,4,rep,name=labels" json:"labels,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func MakeObjectIDs ¶
func MakeObjectIDs(pair *TraceIdentifierPair) ([]*Object, error)
MakeTraceObjectIDs create a list of Objects based on the Trace / Trace ID input Objects are ordered the same as the output objects of the trace
func (*Object) Descriptor ¶
func (*Object) GetStatus ¶
func (m *Object) GetStatus() ObjectStatus
func (*Object) GetVersionID ¶
func (*Object) ProtoMessage ¶
func (*Object) ProtoMessage()
func (*Object) XXX_DiscardUnknown ¶
func (m *Object) XXX_DiscardUnknown()
func (*Object) XXX_Marshal ¶
func (*Object) XXX_Unmarshal ¶
type ObjectList ¶
type ObjectList struct { List []*Object `protobuf:"bytes,1,rep,name=list" json:"list,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ObjectList) Descriptor ¶
func (*ObjectList) Descriptor() ([]byte, []int)
func (*ObjectList) GetList ¶
func (m *ObjectList) GetList() []*Object
func (*ObjectList) ProtoMessage ¶
func (*ObjectList) ProtoMessage()
func (*ObjectList) Reset ¶
func (m *ObjectList) Reset()
func (*ObjectList) String ¶
func (m *ObjectList) String() string
func (*ObjectList) XXX_DiscardUnknown ¶
func (m *ObjectList) XXX_DiscardUnknown()
func (*ObjectList) XXX_Marshal ¶
func (m *ObjectList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ObjectList) XXX_Merge ¶
func (dst *ObjectList) XXX_Merge(src proto.Message)
func (*ObjectList) XXX_Size ¶
func (m *ObjectList) XXX_Size() int
func (*ObjectList) XXX_Unmarshal ¶
func (m *ObjectList) XXX_Unmarshal(b []byte) error
type ObjectStatus ¶
type ObjectStatus int32
const ( ObjectStatus_ACTIVE ObjectStatus = 0 ObjectStatus_INACTIVE ObjectStatus = 1 ObjectStatus_LOCKED ObjectStatus = 2 )
func (ObjectStatus) EnumDescriptor ¶
func (ObjectStatus) EnumDescriptor() ([]byte, []int)
func (ObjectStatus) String ¶
func (x ObjectStatus) String() string
type ObjectTraceIDPair ¶
type ObjectTraceIDPair struct { TraceID []byte `protobuf:"bytes,1,opt,name=traceID,proto3" json:"traceID,omitempty"` Objects []*Object `protobuf:"bytes,2,rep,name=objects" json:"objects,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*ObjectTraceIDPair) Descriptor ¶
func (*ObjectTraceIDPair) Descriptor() ([]byte, []int)
func (*ObjectTraceIDPair) GetObjects ¶
func (m *ObjectTraceIDPair) GetObjects() []*Object
func (*ObjectTraceIDPair) GetTraceID ¶
func (m *ObjectTraceIDPair) GetTraceID() []byte
func (*ObjectTraceIDPair) ProtoMessage ¶
func (*ObjectTraceIDPair) ProtoMessage()
func (*ObjectTraceIDPair) Reset ¶
func (m *ObjectTraceIDPair) Reset()
func (*ObjectTraceIDPair) String ¶
func (m *ObjectTraceIDPair) String() string
func (*ObjectTraceIDPair) XXX_DiscardUnknown ¶
func (m *ObjectTraceIDPair) XXX_DiscardUnknown()
func (*ObjectTraceIDPair) XXX_Marshal ¶
func (m *ObjectTraceIDPair) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ObjectTraceIDPair) XXX_Merge ¶
func (dst *ObjectTraceIDPair) XXX_Merge(src proto.Message)
func (*ObjectTraceIDPair) XXX_Size ¶
func (m *ObjectTraceIDPair) XXX_Size() int
func (*ObjectTraceIDPair) XXX_Unmarshal ¶
func (m *ObjectTraceIDPair) XXX_Unmarshal(b []byte) error
type OutputObject ¶
type OutputObject struct { Labels []string `protobuf:"bytes,1,rep,name=labels" json:"labels,omitempty"` Object []byte `protobuf:"bytes,2,opt,name=object,proto3" json:"object,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*OutputObject) Descriptor ¶
func (*OutputObject) Descriptor() ([]byte, []int)
func (*OutputObject) GetLabels ¶
func (m *OutputObject) GetLabels() []string
func (*OutputObject) GetObject ¶
func (m *OutputObject) GetObject() []byte
func (*OutputObject) ProtoMessage ¶
func (*OutputObject) ProtoMessage()
func (*OutputObject) Reset ¶
func (m *OutputObject) Reset()
func (*OutputObject) String ¶
func (m *OutputObject) String() string
func (*OutputObject) XXX_DiscardUnknown ¶
func (m *OutputObject) XXX_DiscardUnknown()
func (*OutputObject) XXX_Marshal ¶
func (m *OutputObject) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*OutputObject) XXX_Merge ¶
func (dst *OutputObject) XXX_Merge(src proto.Message)
func (*OutputObject) XXX_Size ¶
func (m *OutputObject) XXX_Size() int
func (*OutputObject) XXX_Unmarshal ¶
func (m *OutputObject) XXX_Unmarshal(b []byte) error
type QueryObjectRequest ¶
type QueryObjectRequest struct { VersionID []byte `protobuf:"bytes,1,opt,name=versionID,proto3" json:"versionID,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*QueryObjectRequest) Descriptor ¶
func (*QueryObjectRequest) Descriptor() ([]byte, []int)
func (*QueryObjectRequest) GetVersionID ¶
func (m *QueryObjectRequest) GetVersionID() []byte
func (*QueryObjectRequest) ProtoMessage ¶
func (*QueryObjectRequest) ProtoMessage()
func (*QueryObjectRequest) Reset ¶
func (m *QueryObjectRequest) Reset()
func (*QueryObjectRequest) String ¶
func (m *QueryObjectRequest) String() string
func (*QueryObjectRequest) XXX_DiscardUnknown ¶
func (m *QueryObjectRequest) XXX_DiscardUnknown()
func (*QueryObjectRequest) XXX_Marshal ¶
func (m *QueryObjectRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryObjectRequest) XXX_Merge ¶
func (dst *QueryObjectRequest) XXX_Merge(src proto.Message)
func (*QueryObjectRequest) XXX_Size ¶
func (m *QueryObjectRequest) XXX_Size() int
func (*QueryObjectRequest) XXX_Unmarshal ¶
func (m *QueryObjectRequest) XXX_Unmarshal(b []byte) error
type QueryObjectResponse ¶
type QueryObjectResponse struct { Object *Object `protobuf:"bytes,1,opt,name=object" json:"object,omitempty"` Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*QueryObjectResponse) Descriptor ¶
func (*QueryObjectResponse) Descriptor() ([]byte, []int)
func (*QueryObjectResponse) GetError ¶
func (m *QueryObjectResponse) GetError() string
func (*QueryObjectResponse) GetObject ¶
func (m *QueryObjectResponse) GetObject() *Object
func (*QueryObjectResponse) ProtoMessage ¶
func (*QueryObjectResponse) ProtoMessage()
func (*QueryObjectResponse) Reset ¶
func (m *QueryObjectResponse) Reset()
func (*QueryObjectResponse) String ¶
func (m *QueryObjectResponse) String() string
func (*QueryObjectResponse) XXX_DiscardUnknown ¶
func (m *QueryObjectResponse) XXX_DiscardUnknown()
func (*QueryObjectResponse) XXX_Marshal ¶
func (m *QueryObjectResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*QueryObjectResponse) XXX_Merge ¶
func (dst *QueryObjectResponse) XXX_Merge(src proto.Message)
func (*QueryObjectResponse) XXX_Size ¶
func (m *QueryObjectResponse) XXX_Size() int
func (*QueryObjectResponse) XXX_Unmarshal ¶
func (m *QueryObjectResponse) XXX_Unmarshal(b []byte) error
type SBACDecision ¶
type SBACDecision int32
const ( SBACDecision_ACCEPT SBACDecision = 0 SBACDecision_REJECT SBACDecision = 1 )
func (SBACDecision) EnumDescriptor ¶
func (SBACDecision) EnumDescriptor() ([]byte, []int)
func (SBACDecision) String ¶
func (x SBACDecision) String() string
type SBACEventAction ¶
type SBACMessage ¶
type SBACMessage struct { Op SBACOp `protobuf:"varint,1,opt,name=op,proto3,enum=sbac.SBACOp" json:"op,omitempty"` Decision SBACDecision `protobuf:"varint,2,opt,name=decision,proto3,enum=sbac.SBACDecision" json:"decision,omitempty"` TxID []byte `protobuf:"bytes,3,opt,name=txId,proto3" json:"txId,omitempty"` Tx *Transaction `protobuf:"bytes,4,opt,name=tx" json:"tx,omitempty"` Evidences map[uint64][]byte `` /* 153-byte string literal not displayed */ Signature []byte `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature,omitempty"` PeerID uint64 `protobuf:"varint,7,opt,name=peerId,proto3" json:"peerId,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SBACMessage) Descriptor ¶
func (*SBACMessage) Descriptor() ([]byte, []int)
func (*SBACMessage) GetDecision ¶
func (m *SBACMessage) GetDecision() SBACDecision
func (*SBACMessage) GetEvidences ¶
func (m *SBACMessage) GetEvidences() map[uint64][]byte
func (*SBACMessage) GetOp ¶
func (m *SBACMessage) GetOp() SBACOp
func (*SBACMessage) GetPeerID ¶
func (m *SBACMessage) GetPeerID() uint64
func (*SBACMessage) GetSignature ¶
func (m *SBACMessage) GetSignature() []byte
func (*SBACMessage) GetTx ¶
func (m *SBACMessage) GetTx() *Transaction
func (*SBACMessage) GetTxID ¶
func (m *SBACMessage) GetTxID() []byte
func (*SBACMessage) ProtoMessage ¶
func (*SBACMessage) ProtoMessage()
func (*SBACMessage) Reset ¶
func (m *SBACMessage) Reset()
func (*SBACMessage) String ¶
func (m *SBACMessage) String() string
func (*SBACMessage) XXX_DiscardUnknown ¶
func (m *SBACMessage) XXX_DiscardUnknown()
func (*SBACMessage) XXX_Marshal ¶
func (m *SBACMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SBACMessage) XXX_Merge ¶
func (dst *SBACMessage) XXX_Merge(src proto.Message)
func (*SBACMessage) XXX_Size ¶
func (m *SBACMessage) XXX_Size() int
func (*SBACMessage) XXX_Unmarshal ¶
func (m *SBACMessage) XXX_Unmarshal(b []byte) error
type SBACMessageAck ¶
type SBACMessageAck struct { LastID uint64 `protobuf:"varint,1,opt,name=lastId,proto3" json:"lastId,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*SBACMessageAck) Descriptor ¶
func (*SBACMessageAck) Descriptor() ([]byte, []int)
func (*SBACMessageAck) GetLastID ¶
func (m *SBACMessageAck) GetLastID() uint64
func (*SBACMessageAck) ProtoMessage ¶
func (*SBACMessageAck) ProtoMessage()
func (*SBACMessageAck) Reset ¶
func (m *SBACMessageAck) Reset()
func (*SBACMessageAck) String ¶
func (m *SBACMessageAck) String() string
func (*SBACMessageAck) XXX_DiscardUnknown ¶
func (m *SBACMessageAck) XXX_DiscardUnknown()
func (*SBACMessageAck) XXX_Marshal ¶
func (m *SBACMessageAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SBACMessageAck) XXX_Merge ¶
func (dst *SBACMessageAck) XXX_Merge(src proto.Message)
func (*SBACMessageAck) XXX_Size ¶
func (m *SBACMessageAck) XXX_Size() int
func (*SBACMessageAck) XXX_Unmarshal ¶
func (m *SBACMessageAck) XXX_Unmarshal(b []byte) error
type SBACStateMachine ¶
type SBACStateMachine struct {
// contains filtered or unexported fields
}
func NewSBACStateMachine ¶
func NewSBACStateMachine(phase SBACOp, action SBACEventAction) *SBACStateMachine
func (*SBACStateMachine) Data ¶
func (c *SBACStateMachine) Data() interface{}
func (*SBACStateMachine) GetDecisions ¶
func (c *SBACStateMachine) GetDecisions() map[uint64]SignedDecision
func (*SBACStateMachine) Phase ¶
func (c *SBACStateMachine) Phase() SBACOp
func (*SBACStateMachine) SetDecision ¶
func (c *SBACStateMachine) SetDecision(n uint64, d SignedDecision)
func (*SBACStateMachine) State ¶
func (c *SBACStateMachine) State() StateSBAC
type ServiceSBAC ¶
type ServiceSBAC struct {
// contains filtered or unexported fields
}
func New ¶
func New(cfg *Config) (*ServiceSBAC, error)
func (*ServiceSBAC) AddTransaction ¶
func (s *ServiceSBAC) AddTransaction( ctx context.Context, tx *Transaction, evidences map[uint64][]byte, ) ([]*Object, error)
func (*ServiceSBAC) Name ¶
func (s *ServiceSBAC) Name() string
func (*ServiceSBAC) QueryObjectByVersionID ¶
func (s *ServiceSBAC) QueryObjectByVersionID(versionid []byte) ([]byte, error)
func (*ServiceSBAC) StatesReport ¶
func (s *ServiceSBAC) StatesReport(ctx context.Context) *StatesReportResponse
func (*ServiceSBAC) Stop ¶
func (s *ServiceSBAC) Stop() error
type SignedDecision ¶
type SignedDecision struct { Decision SBACDecision Signature []byte }
type State ¶
type State uint8
const ( StateWaitingForConsensus1 State = iota // waiting for the first consensus to be reached, in order to process the transaction inside the shard. StateObjectLocked // check if objects exists and are actives StateAcceptPhase1Broadcasted // 2-phase commit phase 1 StateRejectPhase1Broadcasted StateWaitingForPhase1 StateConsensus2Triggered StateWaitingForConsensus2 // second consensus inside the shard, in order to confirm accept of the transaction after the first phase of 2-phase commit. also should kick bad nodes in the future StateAcceptPhase2Broadcasted // 2-phase commit phase 2 StateRejectPhase2Broadcasted StateWaitingForPhase2 StateObjectsDeactivated StateObjectsCreated StateCommitObjectsBroadcasted // notify other shards to create the objects StateWaitingForCommit // node which need to create object start it state machine with this StateConsensusCommitTriggered StateWaitingForConsensusCommit StateAborted StateSucceeded )
type StateConsensus ¶
type StateConsensus uint8
const ( StateConsensusWaiting StateConsensus = iota StateConsensusAccepted StateConsensusRejected )
func (StateConsensus) String ¶
func (e StateConsensus) String() string
type StateMachine ¶
type StateMachine struct {
// contains filtered or unexported fields
}
func NewStateMachine ¶
func NewStateMachine(cfg *StateMachineConfig) *StateMachine
func (*StateMachine) OnEvent ¶
func (sm *StateMachine) OnEvent(e Event)
func (*StateMachine) State ¶
func (sm *StateMachine) State() State
func (*StateMachine) StateReport ¶
func (sm *StateMachine) StateReport() *StateReport
type StateMachineConfig ¶
type StateMachineConfig struct { ConsensusAction ConsensusEventAction SBACAction SBACEventAction Table *StateTable Detail *DetailTx InitialState State }
type StateMachineScheduler ¶
type StateMachineScheduler struct {
// contains filtered or unexported fields
}
func NewStateMachineScheduler ¶
func NewStateMachineScheduler( cea ConsensusEventAction, sea SBACEventAction, table *StateTable, ) *StateMachineScheduler
func (*StateMachineScheduler) Add ¶
func (s *StateMachineScheduler) Add(detail *DetailTx, initialState State) *StateMachine
func (*StateMachineScheduler) Get ¶
func (s *StateMachineScheduler) Get(txID []byte) (*StateMachine, bool)
func (*StateMachineScheduler) GetOrCreate ¶
func (s *StateMachineScheduler) GetOrCreate( detail *DetailTx, initialState State) *StateMachine
func (*StateMachineScheduler) RunGC ¶
func (s *StateMachineScheduler) RunGC()
func (*StateMachineScheduler) StatesReport ¶
func (s *StateMachineScheduler) StatesReport() []*StateReport
type StateReport ¶
type StateReport struct { HashID uint32 `protobuf:"varint,1,opt,name=hashID,proto3" json:"hashID,omitempty"` CommitDecisions map[uint64]bool `` /* 166-byte string literal not displayed */ Phase1Decisions map[uint64]bool `` /* 166-byte string literal not displayed */ Phase2Decisions map[uint64]bool `` /* 166-byte string literal not displayed */ State string `protobuf:"bytes,5,opt,name=state,proto3" json:"state,omitempty"` PendingEvents int32 `protobuf:"varint,6,opt,name=pendingEvents,proto3" json:"pendingEvents,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*StateReport) Descriptor ¶
func (*StateReport) Descriptor() ([]byte, []int)
func (*StateReport) GetCommitDecisions ¶
func (m *StateReport) GetCommitDecisions() map[uint64]bool
func (*StateReport) GetHashID ¶
func (m *StateReport) GetHashID() uint32
func (*StateReport) GetPendingEvents ¶
func (m *StateReport) GetPendingEvents() int32
func (*StateReport) GetPhase1Decisions ¶
func (m *StateReport) GetPhase1Decisions() map[uint64]bool
func (*StateReport) GetPhase2Decisions ¶
func (m *StateReport) GetPhase2Decisions() map[uint64]bool
func (*StateReport) GetState ¶
func (m *StateReport) GetState() string
func (*StateReport) ProtoMessage ¶
func (*StateReport) ProtoMessage()
func (*StateReport) Reset ¶
func (m *StateReport) Reset()
func (*StateReport) String ¶
func (m *StateReport) String() string
func (*StateReport) XXX_DiscardUnknown ¶
func (m *StateReport) XXX_DiscardUnknown()
func (*StateReport) XXX_Marshal ¶
func (m *StateReport) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*StateReport) XXX_Merge ¶
func (dst *StateReport) XXX_Merge(src proto.Message)
func (*StateReport) XXX_Size ¶
func (m *StateReport) XXX_Size() int
func (*StateReport) XXX_Unmarshal ¶
func (m *StateReport) XXX_Unmarshal(b []byte) error
type StateTable ¶
type StateTable struct {
// contains filtered or unexported fields
}
type StateTransition ¶
type StatesReportResponse ¶
type StatesReportResponse struct { States []*StateReport `protobuf:"bytes,1,rep,name=states" json:"states,omitempty"` EventsInQueue int32 `protobuf:"varint,2,opt,name=eventsInQueue,proto3" json:"eventsInQueue,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*StatesReportResponse) Descriptor ¶
func (*StatesReportResponse) Descriptor() ([]byte, []int)
func (*StatesReportResponse) GetEventsInQueue ¶
func (m *StatesReportResponse) GetEventsInQueue() int32
func (*StatesReportResponse) GetStates ¶
func (m *StatesReportResponse) GetStates() []*StateReport
func (*StatesReportResponse) ProtoMessage ¶
func (*StatesReportResponse) ProtoMessage()
func (*StatesReportResponse) Reset ¶
func (m *StatesReportResponse) Reset()
func (*StatesReportResponse) String ¶
func (m *StatesReportResponse) String() string
func (*StatesReportResponse) XXX_DiscardUnknown ¶
func (m *StatesReportResponse) XXX_DiscardUnknown()
func (*StatesReportResponse) XXX_Marshal ¶
func (m *StatesReportResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*StatesReportResponse) XXX_Merge ¶
func (dst *StatesReportResponse) XXX_Merge(src proto.Message)
func (*StatesReportResponse) XXX_Size ¶
func (m *StatesReportResponse) XXX_Size() int
func (*StatesReportResponse) XXX_Unmarshal ¶
func (m *StatesReportResponse) XXX_Unmarshal(b []byte) error
type Store ¶
type Store interface { Close() error CommitTransaction( txnkey []byte, inobjkeys [][]byte, objs []*Object) error LockObjects(objkeys [][]byte) error UnlockObjects(objkeys [][]byte) error AddTransaction(txkey []byte, value []byte) error GetTransaction(txkey []byte) ([]byte, bool, error) GetObjects(vids [][]byte) ([]*Object, error) DeactivateObjects(keys [][]byte) error CreateObjects(objs []*Object) error CreateObject(vid, value []byte) (*Object, error) DeleteObjects(objkeys [][]byte) error FinishTransaction(txnkey []byte) error TxnFinished(txnkey []byte) (bool, error) }
type Trace ¶
type Trace struct { ContractID string `protobuf:"bytes,1,opt,name=contractID,proto3" json:"contractID,omitempty"` Procedure string `protobuf:"bytes,2,opt,name=procedure,proto3" json:"procedure,omitempty"` InputObjectVersionIDs [][]byte `protobuf:"bytes,3,rep,name=inputObjectVersionIDs" json:"inputObjectVersionIDs,omitempty"` InputReferenceVersionIDs [][]byte `protobuf:"bytes,4,rep,name=inputReferenceVersionIDs" json:"inputReferenceVersionIDs,omitempty"` OutputObjects []*OutputObject `protobuf:"bytes,5,rep,name=outputObjects" json:"outputObjects,omitempty"` Parameters [][]byte `protobuf:"bytes,6,rep,name=parameters" json:"parameters,omitempty"` Returns [][]byte `protobuf:"bytes,7,rep,name=returns" json:"returns,omitempty"` Dependencies []*Trace `protobuf:"bytes,9,rep,name=dependencies" json:"dependencies,omitempty"` InputObjects [][]byte `protobuf:"bytes,10,rep,name=inputObjects" json:"inputObjects,omitempty"` InputReferences [][]byte `protobuf:"bytes,11,rep,name=inputReferences" json:"inputReferences,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Trace) Descriptor ¶
func (*Trace) GetContractID ¶
func (*Trace) GetDependencies ¶
func (*Trace) GetInputObjectVersionIDs ¶
func (*Trace) GetInputObjects ¶
func (*Trace) GetInputReferenceVersionIDs ¶
func (*Trace) GetInputReferences ¶
func (*Trace) GetOutputObjects ¶
func (m *Trace) GetOutputObjects() []*OutputObject
func (*Trace) GetParameters ¶
func (*Trace) GetProcedure ¶
func (*Trace) GetReturns ¶
func (*Trace) ProtoMessage ¶
func (*Trace) ProtoMessage()
func (*Trace) XXX_DiscardUnknown ¶
func (m *Trace) XXX_DiscardUnknown()
func (*Trace) XXX_Marshal ¶
func (*Trace) XXX_Unmarshal ¶
type TraceIdentifierPair ¶
TraceIdentifierPair is a pair of a trace and it's identifier
func MakeTraceIDs ¶
func MakeTraceIDs(traces []*Trace) ([]TraceIdentifierPair, error)
MakeTraceIDs generate trace IDs for all traces in the given list
type TraceObjectPair ¶
type TraceObjectPair struct { OutputObjects []*Object Trace TraceIdentifierPair }
TraceOutputObjectIDPair is composed of a trace and the list of output object IDs it create ordered in the same order than the orginal output objects
func MakeTraceObjectPairs ¶
func MakeTraceObjectPairs(traces []TraceIdentifierPair) ([]TraceObjectPair, error)
MakeObjectID create a list of Object based on the traces / traces identifier
type Transaction ¶
type Transaction struct { Traces []*Trace `protobuf:"bytes,1,rep,name=traces" json:"traces,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Transaction) Descriptor ¶
func (*Transaction) Descriptor() ([]byte, []int)
func (*Transaction) GetTraces ¶
func (m *Transaction) GetTraces() []*Trace
func (*Transaction) ProtoMessage ¶
func (*Transaction) ProtoMessage()
func (*Transaction) Reset ¶
func (m *Transaction) Reset()
func (*Transaction) String ¶
func (m *Transaction) String() string
func (*Transaction) XXX_DiscardUnknown ¶
func (m *Transaction) XXX_DiscardUnknown()
func (*Transaction) XXX_Marshal ¶
func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*Transaction) XXX_Merge ¶
func (dst *Transaction) XXX_Merge(src proto.Message)
func (*Transaction) XXX_Size ¶
func (m *Transaction) XXX_Size() int
func (*Transaction) XXX_Unmarshal ¶
func (m *Transaction) XXX_Unmarshal(b []byte) error
type Transition ¶
Transition are called when the state is change from a current state to a new one. return a State which may involved a new transition as well.