Documentation
¶
Overview ¶
Package artifactmanager provides high-level storage API for logic runner module.
Index ¶
- Variables
- type ChildIterator
- type ClassDescriptor
- type CodeDescriptor
- type LedgerArtifactManager
- func (m *LedgerArtifactManager) ActivateClass(ctx core.Context, domain, request, code core.RecordRef, ...) (*core.RecordID, error)
- func (m *LedgerArtifactManager) ActivateObject(ctx core.Context, domain core.RecordRef, object core.RecordRef, ...) (*core.RecordID, error)
- func (m *LedgerArtifactManager) ActivateObjectDelegate(ctx core.Context, domain core.RecordRef, request core.RecordRef, ...) (*core.RecordID, error)
- func (m *LedgerArtifactManager) DeactivateClass(ctx core.Context, domain, request, class core.RecordRef, state core.RecordID) (*core.RecordID, error)
- func (m *LedgerArtifactManager) DeactivateObject(ctx core.Context, domain, request, object core.RecordRef) (*core.RecordID, error)
- func (m *LedgerArtifactManager) DeclareType(ctx core.Context, domain, request core.RecordRef, typeDec []byte) (*core.RecordID, error)
- func (m *LedgerArtifactManager) DeployCode(ctx core.Context, domain core.RecordRef, request core.RecordRef, code []byte, ...) (*core.RecordID, error)
- func (m *LedgerArtifactManager) GenesisRef() *core.RecordRef
- func (m *LedgerArtifactManager) GetChildren(ctx core.Context, parent core.RecordRef, pulse *core.PulseNumber) (core.RefIterator, error)
- func (m *LedgerArtifactManager) GetClass(ctx core.Context, head core.RecordRef, state *core.RecordRef) (core.ClassDescriptor, error)
- func (m *LedgerArtifactManager) GetCode(ctx core.Context, code core.RecordRef) (core.CodeDescriptor, error)
- func (m *LedgerArtifactManager) GetDelegate(ctx core.Context, head, asClass core.RecordRef) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) GetObject(ctx core.Context, head core.RecordRef, state *core.RecordRef) (core.ObjectDescriptor, error)
- func (m *LedgerArtifactManager) Link(components core.Components) error
- func (m *LedgerArtifactManager) RegisterRequest(ctx core.Context, msg core.Message) (*core.RecordID, error)
- func (m *LedgerArtifactManager) UpdateClass(ctx core.Context, domain, request, class, code core.RecordRef, ...) (*core.RecordID, error)
- func (m *LedgerArtifactManager) UpdateObject(ctx core.Context, domain core.RecordRef, request core.RecordRef, ...) (*core.RecordID, error)
- type MessageHandler
- type ObjectDescriptor
- func (d *ObjectDescriptor) Children(pulse *core.PulseNumber) (core.RefIterator, error)
- func (d *ObjectDescriptor) ClassDescriptor(state *core.RecordRef) (core.ClassDescriptor, error)
- func (d *ObjectDescriptor) HeadRef() *core.RecordRef
- func (d *ObjectDescriptor) Memory() []byte
- func (d *ObjectDescriptor) StateID() *core.RecordID
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidRef = errors.New("invalid reference") ErrClassDeactivated = errors.New("class is deactivated") ErrClassDelegateAlreadyExists = errors.New("delegate for this class already exists") ErrClassIsNotActive = errors.New("class is not active") ErrObjectDeactivated = errors.New("object is deactivated") ErrInconsistentIndex = errors.New("inconsistent index") ErrWrongObject = errors.New("provided object is not and instance of provided class") ErrNotFound = errors.New("object not found") ErrUnexpectedReply = errors.New("unexpected reply") )
Custom errors possibly useful to check by artifact manager callers.
Functions ¶
This section is empty.
Types ¶
type ChildIterator ¶ added in v0.5.0
type ChildIterator struct {
// contains filtered or unexported fields
}
ChildIterator is used to iterate over objects children.
During iteration children refs will be fetched from remote source (parent object).
func NewChildIterator ¶ added in v0.5.0
func NewChildIterator( mb core.MessageBus, parent core.RecordRef, fromPulse *core.PulseNumber, chunkSize int, ) (*ChildIterator, error)
NewChildIterator creates new child iterator.
func (*ChildIterator) HasNext ¶ added in v0.5.0
func (i *ChildIterator) HasNext() bool
HasNext checks if any elements left in iterator.
type ClassDescriptor ¶
type ClassDescriptor struct {
// contains filtered or unexported fields
}
ClassDescriptor represents meta info required to fetch all class data.
func (*ClassDescriptor) CodeDescriptor ¶ added in v0.0.5
func (d *ClassDescriptor) CodeDescriptor() core.CodeDescriptor
CodeDescriptor returns descriptor for fetching object's code data.
func (*ClassDescriptor) HeadRef ¶ added in v0.0.5
func (d *ClassDescriptor) HeadRef() *core.RecordRef
HeadRef returns head reference to represented class record.
func (*ClassDescriptor) StateID ¶ added in v0.5.0
func (d *ClassDescriptor) StateID() *core.RecordID
StateID returns reference to represented class state record.
type CodeDescriptor ¶ added in v0.0.5
type CodeDescriptor struct {
// contains filtered or unexported fields
}
CodeDescriptor represents meta info required to fetch all code data.
func (*CodeDescriptor) Code ¶ added in v0.0.5
func (d *CodeDescriptor) Code() ([]byte, error)
Code returns code data.
func (*CodeDescriptor) MachineType ¶ added in v0.0.6
func (d *CodeDescriptor) MachineType() core.MachineType
MachineType returns code machine type for represented code.
func (*CodeDescriptor) Ref ¶ added in v0.0.5
func (d *CodeDescriptor) Ref() *core.RecordRef
Ref returns reference to represented code record.
type LedgerArtifactManager ¶
type LedgerArtifactManager struct {
// contains filtered or unexported fields
}
LedgerArtifactManager provides concrete API to storage for processing module.
func NewArtifactManger ¶ added in v0.0.5
func NewArtifactManger(db *storage.DB) (*LedgerArtifactManager, error)
NewArtifactManger creates new manager instance.
func (*LedgerArtifactManager) ActivateClass ¶
func (m *LedgerArtifactManager) ActivateClass( ctx core.Context, domain, request, code core.RecordRef, machineType core.MachineType, ) (*core.RecordID, error)
ActivateClass creates activate class record in storage. Provided code reference will be used as a class code.
Request reference will be this class'es identifier and referred as "class head".
func (*LedgerArtifactManager) ActivateObject ¶ added in v0.3.0
func (m *LedgerArtifactManager) ActivateObject( ctx core.Context, domain core.RecordRef, object core.RecordRef, class core.RecordRef, parent core.RecordRef, memory []byte, ) (*core.RecordID, error)
ActivateObject creates activate object record in storage. Provided class reference will be used as objects class memory as memory of created object. If memory is not provided, the class default memory will be used.
Request reference will be this object's identifier and referred as "object head".
func (*LedgerArtifactManager) ActivateObjectDelegate ¶ added in v0.3.0
func (m *LedgerArtifactManager) ActivateObjectDelegate( ctx core.Context, domain core.RecordRef, request core.RecordRef, class core.RecordRef, parent core.RecordRef, memory []byte, ) (*core.RecordID, error)
ActivateObjectDelegate is similar to ActivateObj but it created object will be parent's delegate of provided class.
func (*LedgerArtifactManager) DeactivateClass ¶
func (m *LedgerArtifactManager) DeactivateClass( ctx core.Context, domain, request, class core.RecordRef, state core.RecordID, ) (*core.RecordID, error)
DeactivateClass creates deactivate record in storage. Provided reference should be a reference to the head of the class. If class is already deactivated, an error should be returned.
Deactivated class cannot be changed or instantiate objects.
func (*LedgerArtifactManager) DeactivateObject ¶ added in v0.3.0
func (m *LedgerArtifactManager) DeactivateObject( ctx core.Context, domain, request, object core.RecordRef, ) (*core.RecordID, error)
DeactivateObject creates deactivate object record in storage. Provided reference should be a reference to the head of the object. If object is already deactivated, an error should be returned.
Deactivated object cannot be changed.
func (*LedgerArtifactManager) DeclareType ¶ added in v0.0.5
func (m *LedgerArtifactManager) DeclareType( ctx core.Context, domain, request core.RecordRef, typeDec []byte, ) (*core.RecordID, error)
DeclareType creates new type record in storage.
Type is a contract interface. It contains one method signature.
func (*LedgerArtifactManager) DeployCode ¶
func (m *LedgerArtifactManager) DeployCode( ctx core.Context, domain core.RecordRef, request core.RecordRef, code []byte, machineType core.MachineType, ) (*core.RecordID, error)
DeployCode creates new code record in storage.
Code records are used to activate class or as migration code for an object.
func (*LedgerArtifactManager) GenesisRef ¶ added in v0.6.0
func (m *LedgerArtifactManager) GenesisRef() *core.RecordRef
GenesisRef returns the root record reference.
Root record is the parent for all top-level records.
func (*LedgerArtifactManager) GetChildren ¶ added in v0.5.0
func (m *LedgerArtifactManager) GetChildren( ctx core.Context, parent core.RecordRef, pulse *core.PulseNumber, ) (core.RefIterator, error)
GetChildren returns children iterator.
During iteration children refs will be fetched from remote source (parent object).
func (*LedgerArtifactManager) GetClass ¶ added in v0.3.0
func (m *LedgerArtifactManager) GetClass( ctx core.Context, head core.RecordRef, state *core.RecordRef, ) (core.ClassDescriptor, error)
GetClass returns descriptor for provided state.
If provided state is nil, the latest state will be returned (with deactivation check). Returned descriptor will provide methods for fetching all related data.
func (*LedgerArtifactManager) GetCode ¶ added in v0.0.5
func (m *LedgerArtifactManager) GetCode( ctx core.Context, code core.RecordRef, ) (core.CodeDescriptor, error)
GetCode returns code from code record by provided reference according to provided machine preference.
This method is used by VM to fetch code for execution.
func (*LedgerArtifactManager) GetDelegate ¶ added in v0.3.0
func (m *LedgerArtifactManager) GetDelegate( ctx core.Context, head, asClass core.RecordRef, ) (*core.RecordRef, error)
GetDelegate returns provided object's delegate reference for provided class.
Object delegate should be previously created for this object. If object delegate does not exist, an error will be returned.
func (*LedgerArtifactManager) GetObject ¶ added in v0.3.0
func (m *LedgerArtifactManager) GetObject( ctx core.Context, head core.RecordRef, state *core.RecordRef, ) (core.ObjectDescriptor, error)
GetObject returns descriptor for provided state.
If provided state is nil, the latest state will be returned (with deactivation check). Returned descriptor will provide methods for fetching all related data.
func (*LedgerArtifactManager) Link ¶ added in v0.3.0
func (m *LedgerArtifactManager) Link(components core.Components) error
Link links external components.
func (*LedgerArtifactManager) RegisterRequest ¶ added in v0.5.0
func (m *LedgerArtifactManager) RegisterRequest( ctx core.Context, msg core.Message, ) (*core.RecordID, error)
RegisterRequest sends message for request registration, returns request record Ref if request successfully created or already exists.
func (*LedgerArtifactManager) UpdateClass ¶
func (m *LedgerArtifactManager) UpdateClass( ctx core.Context, domain, request, class, code core.RecordRef, machineType core.MachineType, state core.RecordID, ) (*core.RecordID, error)
UpdateClass creates amend class record in storage. Provided reference should be a reference to the head of the class. Migrations are references to code records.
Returned reference will be the latest class state (exact) reference. Migration code will be executed by VM to migrate objects memory in the order they appear in provided slice.
func (*LedgerArtifactManager) UpdateObject ¶ added in v0.3.0
func (m *LedgerArtifactManager) UpdateObject( ctx core.Context, domain core.RecordRef, request core.RecordRef, object core.RecordRef, memory []byte, ) (*core.RecordID, error)
UpdateObject creates amend object record in storage. Provided reference should be a reference to the head of the object. Provided memory well be the new object memory.
Returned reference will be the latest object state (exact) reference.
type MessageHandler ¶ added in v0.4.0
type MessageHandler struct {
// contains filtered or unexported fields
}
MessageHandler processes messages for local storage interaction.
func NewMessageHandler ¶ added in v0.4.0
func NewMessageHandler(db *storage.DB) (*MessageHandler, error)
NewMessageHandler creates new handler.
func (*MessageHandler) Link ¶ added in v0.4.0
func (h *MessageHandler) Link(components core.Components) error
Link links external components.
type ObjectDescriptor ¶
type ObjectDescriptor struct {
// contains filtered or unexported fields
}
ObjectDescriptor represents meta info required to fetch all object data.
func (*ObjectDescriptor) Children ¶ added in v0.3.0
func (d *ObjectDescriptor) Children(pulse *core.PulseNumber) (core.RefIterator, error)
Children returns object's children references.
func (*ObjectDescriptor) ClassDescriptor ¶ added in v0.0.5
func (d *ObjectDescriptor) ClassDescriptor(state *core.RecordRef) (core.ClassDescriptor, error)
ClassDescriptor returns descriptor for fetching object's class data.
func (*ObjectDescriptor) HeadRef ¶ added in v0.0.5
func (d *ObjectDescriptor) HeadRef() *core.RecordRef
HeadRef returns reference to represented object record.
func (*ObjectDescriptor) Memory ¶ added in v0.0.5
func (d *ObjectDescriptor) Memory() []byte
Memory fetches latest memory of the object known to storage.
func (*ObjectDescriptor) StateID ¶ added in v0.5.0
func (d *ObjectDescriptor) StateID() *core.RecordID
StateID returns reference to object state record.