Documentation ¶
Overview ¶
Package resolver provides interface and default implementation of resolvers for getting objects from references. Interface Resolver uses interface{} type for reference, class and proxy (which GetObject returns), because in future implementation its going to be plugin. Virtual machine will be use it and provide resolving logic.
Usage:
package main import ( "github.com/insolar/insolar/genesis/model/class" "github.com/insolar/insolar/genesis/model/object" } func main() { resolver := NewChildResolver(parent) obj, err := resolver.GetObject(ref, class.ObjectID) res := obj.(object.Object) }
Proxy provides interface and default implementation of proxy. It inherited by SmartContractProxy and Factory
Usage:
proxy.SetReference(Reference) sets reference to proxy. proxy.GetReference() gets reference from proxy. proxy.GetParent() always returns nil. proxy.GetClassID() is a proxy call for instance method.
ReferenceContainer provides methods for store Reference as Proxy ¶
Usage:
ref, _ := object.NewReference(domain, record, object.GlobalScope) container = NewReferenceContainer(ref) container.GetClassID() // return string representation of object's class. container.GetStoredReference() // returns stored reference.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var GlobalResolver = newGlobalResolver()
GlobalResolver is a public globalResolver instance for resolving all global references.
Functions ¶
This section is empty.
Types ¶
type BaseProxy ¶ added in v0.0.2
type BaseProxy struct {
// contains filtered or unexported fields
}
BaseProxy is a base implementation of Proxy.
func (*BaseProxy) GetClassID ¶ added in v0.0.2
GetClassID is a proxy call for instance method.
func (*BaseProxy) GetReference ¶ added in v0.0.2
GetReference is a proxy call for instance method.
func (*BaseProxy) SetReference ¶ added in v0.0.2
SetReference is a proxy call for instance method.
type Handler ¶ added in v0.0.2
type Handler struct {
// contains filtered or unexported fields
}
Handler should resolve references from any allowed scopes.
func NewHandler ¶ added in v0.0.2
func NewHandler(p interface{}) *Handler
NewHandler creates new resolverHandler instance.
func (*Handler) GetObject ¶ added in v0.0.2
GetObject resolves object by its reference and return its proxy.
func (*Handler) InitGlobalMap ¶ added in v0.0.2
InitGlobalMap sets globalInstanceMap into globalResolver.
type Proxy ¶
type Proxy interface { object.Child GetReference() object.Reference SetReference(reference object.Reference) }
Proxy marks instance as proxy object.
type ReferenceContainer ¶ added in v0.0.2
type ReferenceContainer struct { BaseProxy // contains filtered or unexported fields }
ReferenceContainer is a implementation of Proxy for containerization purpose.
func NewReferenceContainer ¶ added in v0.0.2
func NewReferenceContainer(ref object.Reference) *ReferenceContainer
NewReferenceContainer creates new container for reference.
func (*ReferenceContainer) GetClassID ¶ added in v0.0.2
func (rc *ReferenceContainer) GetClassID() string
GetClassID return string representation of object's class.
func (*ReferenceContainer) GetStoredReference ¶ added in v0.0.2
func (rc *ReferenceContainer) GetStoredReference() object.Reference
GetStoredReference returns stored reference.