sbac

package
v0.0.0-...-8220f0d Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2019 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var ConsensusOp_name = map[int32]string{
	0: "Consensus1",
	1: "Consensus2",
	2: "ConsensusCommit",
}
View Source
var ConsensusOp_value = map[string]int32{
	"Consensus1":      0,
	"Consensus2":      1,
	"ConsensusCommit": 2,
}
View Source
var ObjectStatus_name = map[int32]string{
	0: "ACTIVE",
	1: "INACTIVE",
	2: "LOCKED",
}
View Source
var ObjectStatus_value = map[string]int32{
	"ACTIVE":   0,
	"INACTIVE": 1,
	"LOCKED":   2,
}
View Source
var Opcode_name = map[int32]string{
	0: "UNKNOWN",
	1: "ADD_TRANSACTION",
	2: "QUERY_OBJECT",
	3: "CREATE_OBJECT",
	4: "STATES",
	5: "SBAC",
	6: "CREATE_OBJECTS",
}
View Source
var Opcode_value = map[string]int32{
	"UNKNOWN":         0,
	"ADD_TRANSACTION": 1,
	"QUERY_OBJECT":    2,
	"CREATE_OBJECT":   3,
	"STATES":          4,
	"SBAC":            5,
	"CREATE_OBJECTS":  6,
}
View Source
var SBACDecision_name = map[int32]string{
	0: "ACCEPT",
	1: "REJECT",
}
View Source
var SBACDecision_value = map[string]int32{
	"ACCEPT": 0,
	"REJECT": 1,
}
View Source
var SBACOp_name = map[int32]string{
	0: "Phase1",
	1: "Phase2",
	2: "Commit",
}
View Source
var SBACOp_value = map[string]int32{
	"Phase1": 0,
	"Phase2": 1,
	"Commit": 2,
}

Functions

func ID

func ID(data []byte) uint32

func MakeTraceID

func MakeTraceID(trace *Trace) ([]byte, error)

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

func NewPendingEvents(cb func(Event) bool) *pendingEvents

Types

type Action

type Action func(s *States) (State, error)

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 Config

type Config struct {
	Broadcaster broadcast.Broadcaster
	Directory   string
	KVStore     kv.Service
	NodeID      uint64
	Top         network.NetTopology
	SigningKey  *config.Key
	Pubsub      pubsub.Server
	ShardSize   uint64
	ShardCount  uint64
	MaxPayload  int
	Key         signature.KeyPair
}

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 (*ConsensusStateMachine) State

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 DetailTx

type DetailTx struct {
	ID        []byte
	RawTx     []byte
	Tx        *Transaction
	Evidences map[uint64][]byte
	HashID    uint32
}

type Event

type Event interface {
	Kind() EventKind
	TxID() []byte
	PeerID() uint64
}

func NewSBACEvent

func NewSBACEvent(data *SBACMessage) Event

type EventKind

type EventKind uint8
const (
	EventKindSBACMessage EventKind = iota
	EventKindConsensus
)

func (EventKind) String

func (e EventKind) String() string

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) Descriptor() ([]byte, []int)

func (*Object) GetLabels

func (m *Object) GetLabels() []string

func (*Object) GetStatus

func (m *Object) GetStatus() ObjectStatus

func (*Object) GetValue

func (m *Object) GetValue() []byte

func (*Object) GetVersionID

func (m *Object) GetVersionID() []byte

func (*Object) ProtoMessage

func (*Object) ProtoMessage()

func (*Object) Reset

func (m *Object) Reset()

func (*Object) String

func (m *Object) String() string

func (*Object) XXX_DiscardUnknown

func (m *Object) XXX_DiscardUnknown()

func (*Object) XXX_Marshal

func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Object) XXX_Merge

func (dst *Object) XXX_Merge(src proto.Message)

func (*Object) XXX_Size

func (m *Object) XXX_Size() int

func (*Object) XXX_Unmarshal

func (m *Object) XXX_Unmarshal(b []byte) error

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 Opcode

type Opcode int32
const (
	Opcode_UNKNOWN         Opcode = 0
	Opcode_ADD_TRANSACTION Opcode = 1
	Opcode_QUERY_OBJECT    Opcode = 2
	Opcode_CREATE_OBJECT   Opcode = 3
	Opcode_STATES          Opcode = 4
	Opcode_SBAC            Opcode = 5
	Opcode_CREATE_OBJECTS  Opcode = 6
)

func (Opcode) EnumDescriptor

func (Opcode) EnumDescriptor() ([]byte, []int)

func (Opcode) String

func (x Opcode) String() string

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 SBACEvent

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

func (*SBACEvent) Kind

func (e *SBACEvent) Kind() EventKind

func (*SBACEvent) PeerID

func (e *SBACEvent) PeerID() uint64

func (*SBACEvent) TxID

func (e *SBACEvent) TxID() []byte

type SBACEventAction

type SBACEventAction func(st *States, decisions map[uint64]SignedDecision, e *SBACEvent) (StateSBAC, error)

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 SBACOp

type SBACOp int32
const (
	SBACOp_Phase1 SBACOp = 0
	SBACOp_Phase2 SBACOp = 1
	SBACOp_Commit SBACOp = 2
)

func (SBACOp) EnumDescriptor

func (SBACOp) EnumDescriptor() ([]byte, []int)

func (SBACOp) String

func (x SBACOp) String() string

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 Service

type Service interface {
	QueryObjectByVersionID(versionid []byte) ([]byte, error)
}

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) Handle

func (s *ServiceSBAC) Handle(peerID uint64, m *service.Message) (*service.Message, 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
)

func (State) String

func (s State) String() string

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 StateSBAC

type StateSBAC uint8
const (
	StateSBACWaiting StateSBAC = iota
	StateSBACAccepted
	StateSBACRejected
)

func (StateSBAC) String

func (e StateSBAC) String() string

type StateTable

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

type StateTransition

type StateTransition struct {
	From State
	To   State
}

type States

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

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) Descriptor() ([]byte, []int)

func (*Trace) GetContractID

func (m *Trace) GetContractID() string

func (*Trace) GetDependencies

func (m *Trace) GetDependencies() []*Trace

func (*Trace) GetInputObjectVersionIDs

func (m *Trace) GetInputObjectVersionIDs() [][]byte

func (*Trace) GetInputObjects

func (m *Trace) GetInputObjects() [][]byte

func (*Trace) GetInputReferenceVersionIDs

func (m *Trace) GetInputReferenceVersionIDs() [][]byte

func (*Trace) GetInputReferences

func (m *Trace) GetInputReferences() [][]byte

func (*Trace) GetOutputObjects

func (m *Trace) GetOutputObjects() []*OutputObject

func (*Trace) GetParameters

func (m *Trace) GetParameters() [][]byte

func (*Trace) GetProcedure

func (m *Trace) GetProcedure() string

func (*Trace) GetReturns

func (m *Trace) GetReturns() [][]byte

func (*Trace) ProtoMessage

func (*Trace) ProtoMessage()

func (*Trace) Reset

func (m *Trace) Reset()

func (*Trace) String

func (m *Trace) String() string

func (*Trace) XXX_DiscardUnknown

func (m *Trace) XXX_DiscardUnknown()

func (*Trace) XXX_Marshal

func (m *Trace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Trace) XXX_Merge

func (dst *Trace) XXX_Merge(src proto.Message)

func (*Trace) XXX_Size

func (m *Trace) XXX_Size() int

func (*Trace) XXX_Unmarshal

func (m *Trace) XXX_Unmarshal(b []byte) error

type TraceIdentifierPair

type TraceIdentifierPair struct {
	ID    []byte
	Trace *Trace
}

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

type Transition func(s *States) (State, error)

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.

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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