Documentation ¶
Overview ¶
Package artifactmanager provides high-level storage API for logic runner module.
Index ¶
- Variables
- type ArtifactManager
- type ClassDescriptor
- type LedgerArtifactManager
- func (m *LedgerArtifactManager) ActivateClass(domainRef, requestRef, codeRef record.Reference, memory record.Memory) (*record.Reference, error)
- func (m *LedgerArtifactManager) ActivateObj(domainRef, requestRef, classRef record.Reference, memory record.Memory) (*record.Reference, error)
- func (m *LedgerArtifactManager) AppendObjDelegate(domainRef, requestRef, objRef record.Reference, memory record.Memory) (*record.Reference, error)
- func (m *LedgerArtifactManager) DeactivateClass(domainRef, requestRef, classRef record.Reference) (*record.Reference, error)
- func (m *LedgerArtifactManager) DeactivateObj(domainRef, requestRef, objRef record.Reference) (*record.Reference, error)
- func (m *LedgerArtifactManager) DeployCode(domainRef, requestRef record.Reference, codeMap map[record.ArchType][]byte) (*record.Reference, error)
- func (m *LedgerArtifactManager) GetExactObj(classState, objectState record.Reference) ([]byte, record.Memory, error)
- func (m *LedgerArtifactManager) GetLatestObj(objectRef, storedClassState, storedObjState record.Reference) (*ClassDescriptor, *ObjectDescriptor, error)
- func (m *LedgerArtifactManager) SetArchPref(pref []record.ArchType)
- func (m *LedgerArtifactManager) UpdateClass(domainRef, requestRef, classRef, codeRef record.Reference, ...) (*record.Reference, error)
- func (m *LedgerArtifactManager) UpdateObj(domainRef, requestRef, objRef record.Reference, memory record.Memory) (*record.Reference, error)
- type ObjectDescriptor
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidRef = errors.New("invalid reference") ErrClassDeactivated = errors.New("class is deactivated") ErrObjectDeactivated = errors.New("object is deactivated") ErrInconsistentIndex = errors.New("inconsistent index") ErrWrongObject = errors.New("provided object is not and instance of provided class") )
Custom errors possibly useful to check by artifact manager callers.
Functions ¶
This section is empty.
Types ¶
type ArtifactManager ¶
type ArtifactManager interface { // SetArchPref stores a list of preferred VM architectures memory. // // When returning classes storage will return compiled code according to this preferences. VM is responsible for // calling this method before fetching object in a new process. If preference is not provided, object getters will // return an error. SetArchPref(pref []record.ArchType) // GetExactObj returns code and memory of provided object/class state. Deactivation records should be ignored // (e.g. object considered to be active). // // This method is used by validator to fetch the exact state of the object that was used by the executor. GetExactObj(classRef, objectRef record.Reference) ([]byte, record.Memory, error) // GetLatestObj returns descriptors for latest known state of the object/class known to the storage. The caller // should provide latest known states of the object/class known to it. If the object or the class is deactivated, // an error should be returned. // // Returned descriptors will provide methods for fetching migrations and appends relative to the provided states. GetLatestObj(objectRef, storedClassState, storedObjState record.Reference) ( *ClassDescriptor, *ObjectDescriptor, error, ) // DeployCode creates new code record in storage. // // Code records are used to activate class or as migration code for an object. DeployCode(domainRef, requestRef record.Reference, codeMap map[record.ArchType][]byte) (*record.Reference, error) // ActivateClass creates activate class record in storage. Provided code reference will be used as a class code // and memory as the default memory for class objects. // // Activation reference will be this class'es identifier and referred as "class head". ActivateClass(domainRef, requestRef, codeRef record.Reference, memory record.Memory) (*record.Reference, 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. DeactivateClass(domainRef, requestRef, classRef record.Reference) (*record.Reference, 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. // // Migration code will be executed by VM to migrate objects memory in the order they appear in provided slice. UpdateClass(domainRef, requestRef, classRef, codeRef record.Reference, migrationRefs []record.Reference) ( *record.Reference, error, ) // ActivateObj 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". ActivateObj(domainRef, requestRef, classRef record.Reference, memory record.Memory) (*record.Reference, error) // DeactivateObj 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. DeactivateObj(domainRef, requestRef, objRef record.Reference) (*record.Reference, error) // UpdateObj 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. // // This will nullify all the object's append delegates. VM is responsible for collecting all appends and adding // them to the new memory manually if its required. UpdateObj(domainRef, requestRef, objRef record.Reference, memory record.Memory) (*record.Reference, error) // AppendObjDelegate creates append object record in storage. Provided reference should be a reference to the head // of the object. Provided memory well be used as append delegate memory. // // Object's delegates will be provided by GetLatestObj. Any object update will nullify all the object's append // delegates. VM is responsible for collecting all appends and adding them to the new memory manually if its // required. AppendObjDelegate(domainRef, requestRef, objRef record.Reference, memory record.Memory) (*record.Reference, error) }
ArtifactManager is a high level storage interface.
type ClassDescriptor ¶
ClassDescriptor represents meta info required to fetch all class data.
func (*ClassDescriptor) GetCode ¶
func (d *ClassDescriptor) GetCode() ([]byte, error)
GetCode fetches the latest class code known to storage. Code will be fetched according to architecture preferences set via SetArchPref in artifact manager. If preferences are not provided, an error will be returned.
func (*ClassDescriptor) GetMigrations ¶
func (d *ClassDescriptor) GetMigrations() ([][]byte, error)
GetMigrations fetches all migrations from provided to artifact manager state to the last state known to storage. VM is responsible for applying these migrations and updating objects.
type LedgerArtifactManager ¶
type LedgerArtifactManager struct {
// contains filtered or unexported fields
}
LedgerArtifactManager provides concrete API to storage for processing module
func (*LedgerArtifactManager) ActivateClass ¶
func (m *LedgerArtifactManager) ActivateClass( domainRef, requestRef, codeRef record.Reference, memory record.Memory, ) (*record.Reference, error)
ActivateClass creates activate class record in storage. Provided code reference will be used as a class code and memory as the default memory for class objects.
Activation reference will be this class'es identifier and referred as "class head".
func (*LedgerArtifactManager) ActivateObj ¶
func (m *LedgerArtifactManager) ActivateObj( domainRef, requestRef, classRef record.Reference, memory record.Memory, ) (*record.Reference, error)
ActivateObj 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) AppendObjDelegate ¶
func (m *LedgerArtifactManager) AppendObjDelegate( domainRef, requestRef, objRef record.Reference, memory record.Memory, ) (*record.Reference, error)
AppendObjDelegate creates append object record in storage. Provided reference should be a reference to the head of the object. Provided memory well be used as append delegate memory.
Object's delegates will be provided by GetLatestObj. Any object update will nullify all the object's append delegates. VM is responsible for collecting all appends and adding them to the new memory manually if its required.
func (*LedgerArtifactManager) DeactivateClass ¶
func (m *LedgerArtifactManager) DeactivateClass( domainRef, requestRef, classRef record.Reference, ) (*record.Reference, 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) DeactivateObj ¶
func (m *LedgerArtifactManager) DeactivateObj( domainRef, requestRef, objRef record.Reference, ) (*record.Reference, error)
DeactivateObj 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) DeployCode ¶
func (m *LedgerArtifactManager) DeployCode( domainRef, requestRef record.Reference, codeMap map[record.ArchType][]byte, ) (*record.Reference, error)
DeployCode creates new code record in storage.
Code records are used to activate class or as migration code for an object.
func (*LedgerArtifactManager) GetExactObj ¶
func (m *LedgerArtifactManager) GetExactObj( classState, objectState record.Reference, ) ([]byte, record.Memory, error)
GetExactObj returns code and memory of provided object/class state. Deactivation records should be ignored (e.g. object considered to be active).
This method is used by validator to fetch the exact state of the object that was used by the executor.
func (*LedgerArtifactManager) GetLatestObj ¶
func (m *LedgerArtifactManager) GetLatestObj( objectRef, storedClassState, storedObjState record.Reference, ) (*ClassDescriptor, *ObjectDescriptor, error)
GetLatestObj returns descriptors for latest known state of the object/class known to the storage. The caller should provide latest known states of the object/class known to it. If the object or the class is deactivated, an error should be returned.
Returned descriptors will provide methods for fetching migrations and appends relative to the provided states.
func (*LedgerArtifactManager) SetArchPref ¶
func (m *LedgerArtifactManager) SetArchPref(pref []record.ArchType)
SetArchPref stores a list of preferred VM architectures memory.
When returning classes storage will return compiled code according to this preferences. VM is responsible for calling this method before fetching object in a new process. If preference is not provided, object getters will return an error.
func (*LedgerArtifactManager) UpdateClass ¶
func (m *LedgerArtifactManager) UpdateClass( domainRef, requestRef, classRef, codeRef record.Reference, migrationRefs []record.Reference, ) (*record.Reference, 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.
Migration code will be executed by VM to migrate objects memory in the order they appear in provided slice.
func (*LedgerArtifactManager) UpdateObj ¶
func (m *LedgerArtifactManager) UpdateObj( domainRef, requestRef, objRef record.Reference, memory record.Memory, ) (*record.Reference, error)
UpdateObj 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.
This will nullify all the object's append delegates. VM is responsible for collecting all appends and adding them to the new memory manually if its required.
type ObjectDescriptor ¶
type ObjectDescriptor struct { StateRef record.Reference // contains filtered or unexported fields }
ObjectDescriptor represents meta info required to fetch all object data.
func (*ObjectDescriptor) GetDelegates ¶
func (d *ObjectDescriptor) GetDelegates() ([]record.Memory, error)
GetDelegates fetches unamended delegates from storage.
VM is responsible for collecting all delegates and adding them to the object memory manually if its required.