Documentation ¶
Overview ¶
Package service contains the implementation of the SUM gRPC service.
Index ¶
- Constants
- type ExecutionPool
- type Service
- func (s *Service) CreateOracle(ctx context.Context, oracle *pb.Oracle) (*pb.OracleResponse, error)
- func (s *Service) CreateRecord(ctx context.Context, record *pb.Record) (*pb.RecordResponse, error)
- func (s *Service) DeleteOracle(ctx context.Context, query *pb.ById) (*pb.OracleResponse, error)
- func (s *Service) DeleteRecord(ctx context.Context, query *pb.ById) (*pb.RecordResponse, error)
- func (s *Service) FindOracle(ctx context.Context, query *pb.ByName) (*pb.OracleResponse, error)
- func (s *Service) FindRecords(ctx context.Context, query *pb.ByMeta) (*pb.FindResponse, error)
- func (s *Service) Info(ctx context.Context, dummy *pb.Empty) (*pb.ServerInfo, error)
- func (s *Service) ListOracles(ctx context.Context, list *pb.ListRequest) (*pb.OracleListResponse, error)
- func (s *Service) ListRecords(ctx context.Context, list *pb.ListRequest) (*pb.RecordListResponse, error)
- func (s *Service) NumOracles() int
- func (s *Service) NumRecords() int
- func (s *Service) ReadOracle(ctx context.Context, query *pb.ById) (*pb.OracleResponse, error)
- func (s *Service) ReadRecord(ctx context.Context, query *pb.ById) (*pb.RecordResponse, error)
- func (s *Service) Run(ctx context.Context, call *pb.Call) (resp *pb.CallResponse, err error)
- func (s *Service) UpdateOracle(ctx context.Context, oracle *pb.Oracle) (*pb.OracleResponse, error)
- func (s *Service) UpdateRecord(ctx context.Context, record *pb.Record) (*pb.RecordResponse, error)
- type VM
Constants ¶
const Version = "1.2.1"
Version holds the current version string of this software.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExecutionPool ¶
type ExecutionPool struct {
// contains filtered or unexported fields
}
ExecutionPool is a pool of clones of a single VM that will be used to scale the execution of an oracle to different goroutines without locking one single shared VM.
func CreateExecutionPool ¶
func CreateExecutionPool(vm *otto.Otto) *ExecutionPool
CreateExecutionPool creates an ExecutionPool object for the given VM.
func (*ExecutionPool) Get ¶
func (p *ExecutionPool) Get() *VM
Get will wait until a VM object in the pool is signaled as free by whoever was using it and then return the first signaled free VM instance.
type Service ¶
Service represents a single instance of the Sum database service.
func New ¶
New loads records and oracles from a given path and returns a new instance of the *Service object.
func (*Service) CreateOracle ¶
CreateOracle compiles and stores a raw *pb.Oracle object. If successful, the identifier of the newly created oracle is returned as the response message.
func (*Service) CreateRecord ¶
CreateRecord creates and stores a new *pb.Record object. If successful, the identifier of the record is returned as the response message.
func (*Service) DeleteOracle ¶
DeleteOracle removes an oracle from the storage given its identifier.
func (*Service) DeleteRecord ¶
DeleteRecord removes a record from the storage given its identifier.
func (*Service) FindOracle ¶
FindOracle returns a list of raw *pb.Oracle objects that match the provided name.
func (*Service) FindRecords ¶
FindRecords returns a FindResponse object corresponding to the records that matched the search criteria.
func (*Service) Info ¶
Info returns a *pb.ServerInfo object with various realtime information about the service and its runtime.
func (*Service) ListOracles ¶ added in v1.2.0
func (s *Service) ListOracles(ctx context.Context, list *pb.ListRequest) (*pb.OracleListResponse, error)
ListOracles returns list of oracles given a ListRequest object.
func (*Service) ListRecords ¶
func (s *Service) ListRecords(ctx context.Context, list *pb.ListRequest) (*pb.RecordListResponse, error)
ListRecords returns list of records given a ListRequest object.
func (*Service) NumOracles ¶
NumOracles returns the number of oracles currently loaded by the service.
func (*Service) NumRecords ¶
NumRecords returns the number of records currently loaded by the service.
func (*Service) ReadOracle ¶
ReadOracle returns a raw *pb.Oracle object given its identifier.
func (*Service) ReadRecord ¶
ReadRecord returns a raw *pb.Record object given its identifier.
func (*Service) Run ¶
Run executes a compiled oracle given its identifier and the arguments in the *pb.Call object.
func (*Service) UpdateOracle ¶
UpdateOracle updates the contents of an oracle with the ones of a raw *pb.Oracle object given its identifier.
func (*Service) UpdateRecord ¶
UpdateRecord updates the contents of a record with the ones of a raw *pb.Record object given its identifier.