Documentation ¶
Overview ¶
Package artifactmanager provides high-level storage API for logic runner module.
Index ¶
- Variables
- type ClassDescriptor
- type CodeDescriptor
- type LedgerArtifactManager
- func (m *LedgerArtifactManager) ActivateClass(domain, request core.RecordRef) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) ActivateObject(domain, request, class, parent core.RecordRef, memory []byte) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) ActivateObjectDelegate(domain, request, class, parent core.RecordRef, memory []byte) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) DeactivateClass(domain, request, class core.RecordRef) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) DeactivateObject(domain, request, object core.RecordRef) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) DeclareType(domain, request core.RecordRef, typeDec []byte) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) DeployCode(domain, request core.RecordRef, codeMap map[core.MachineType][]byte) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) GetClass(head core.RecordRef, state *core.RecordRef) (core.ClassDescriptor, error)
- func (m *LedgerArtifactManager) GetCode(code core.RecordRef, machinePref []core.MachineType) (core.CodeDescriptor, error)
- func (m *LedgerArtifactManager) GetDelegate(head, asClass core.RecordRef) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) GetObject(head core.RecordRef, state *core.RecordRef) (core.ObjectDescriptor, error)
- func (m *LedgerArtifactManager) Link(components core.Components) error
- func (m *LedgerArtifactManager) RootRef() *core.RecordRef
- func (m *LedgerArtifactManager) UpdateClass(domain, request, class, code core.RecordRef, migrations []core.RecordRef) (*core.RecordRef, error)
- func (m *LedgerArtifactManager) UpdateObject(domain, request, object core.RecordRef, memory []byte) (*core.RecordRef, error)
- type MessageHandler
- type ObjectDescriptor
- func (d *ObjectDescriptor) Children() core.RefIterator
- func (d *ObjectDescriptor) ClassDescriptor(state *core.RecordRef) (core.ClassDescriptor, error)
- func (d *ObjectDescriptor) HeadRef() *core.RecordRef
- func (d *ObjectDescriptor) Memory() []byte
- func (d *ObjectDescriptor) StateRef() *core.RecordRef
- type RefIterator
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 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(machinePref []core.MachineType) (core.CodeDescriptor, error)
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) StateRef ¶
func (d *ClassDescriptor) StateRef() *core.RecordRef
StateRef 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
Code returns code for first available machine type for provided machine preference.
func (*CodeDescriptor) MachineType ¶ added in v0.0.6
func (d *CodeDescriptor) MachineType() core.MachineType
MachineType returns first available machine type for provided machine preference.
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( domain, request core.RecordRef, ) (*core.RecordRef, error)
ActivateClass creates activate class record in storage. Provided code reference will be used as a class code.
Activation reference will be this class'es identifier and referred as "class head".
func (*LedgerArtifactManager) ActivateObject ¶ added in v0.3.0
func (m *LedgerArtifactManager) ActivateObject( domain, request, class, parent core.RecordRef, memory []byte, ) (*core.RecordRef, error)
ActivateObject creates activate object record in storage. Provided class reference will be used as objects class memory as memory of crated object. If memory is not provided, the class default memory will be used.
Activation reference will be this object's identifier and referred as "object head".
func (*LedgerArtifactManager) ActivateObjectDelegate ¶ added in v0.3.0
func (m *LedgerArtifactManager) ActivateObjectDelegate( domain, request, class, parent core.RecordRef, memory []byte, ) (*core.RecordRef, 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( domain, request, class core.RecordRef, ) (*core.RecordRef, 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( domain, request, object core.RecordRef, ) (*core.RecordRef, 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( domain, request core.RecordRef, typeDec []byte, ) (*core.RecordRef, 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( domain, request core.RecordRef, codeMap map[core.MachineType][]byte, ) (*core.RecordRef, error)
DeployCode creates new code record in storage.
Code records are used to activate class or as migration code for an object.
func (*LedgerArtifactManager) GetClass ¶ added in v0.3.0
func (m *LedgerArtifactManager) GetClass(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( code core.RecordRef, machinePref []core.MachineType, ) (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
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(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) RootRef ¶ added in v0.0.6
func (m *LedgerArtifactManager) RootRef() *core.RecordRef
RootRef returns the root record reference.
Root record is the parent for all top-level records.
func (*LedgerArtifactManager) UpdateClass ¶
func (m *LedgerArtifactManager) UpdateClass( domain, request, class, code core.RecordRef, migrations []core.RecordRef, ) (*core.RecordRef, 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( domain, request, object core.RecordRef, memory []byte, ) (*core.RecordRef, 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() core.RefIterator
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) StateRef ¶
func (d *ObjectDescriptor) StateRef() *core.RecordRef
StateRef returns reference to object state record.
type RefIterator ¶ added in v0.0.6
type RefIterator struct {
// contains filtered or unexported fields
}
RefIterator implements core.RefIterator.
func (*RefIterator) HasNext ¶ added in v0.0.6
func (i *RefIterator) HasNext() bool
HasNext checks if any elements left in iterator.