Documentation ¶
Overview ¶
Package common regroup structures used by the orchestrator.
Index ¶
- Variables
- func GetEnv(name string) (string, bool)
- func GetEnvOrFallback(name string, fallback string) string
- func GetKeepAliveOptions() grpc.ServerOption
- func GetTLSOptions() grpc.ServerOption
- func MustGetEnv(name string) string
- func MustGetEnvFlag(name string) bool
- func MustParseBool(s string) bool
- func MustParseDuration(duration string) time.Duration
- func MustParseInt(s string) int
- type AppParameters
- type ContextualizedServerStream
- type GrpcMethodChecker
- type MemoryQueue
- type OrchestratorConfiguration
- type OrgCACertList
- type Runnable
- type TransactionChecker
Constants ¶
This section is empty.
Variables ¶
var ReadOnlyMethods = map[string][]string{
"Metric": {"GetMetric", "QueryMetrics"},
"Organization": {"GetAllOrganizations"},
"Function": {"GetFunction", "QueryFunctions"},
"Event": {"QueryEvents"},
"Model": {"GetComputeTaskOutputModels", "CanDisableModel", "GetModel"},
"Dataset": {"GetDataset"},
"DataSample": {"GetDataSample", "QueryDataSamples"},
"DataManager": {"GetDataManager", "QueryDataManagers"},
"ComputeTask": {"QueryTasks", "GetTask", "GetTaskInputAssets"},
"ComputePlan": {"GetPlan", "QueryPlans", "IsPlanRunning"},
"Performance": {"QueryPerformances"},
"Info": {"QueryVersion"},
"FailureReport": {"GetFailureReport"},
}
ReadOnlyMethods maps for service "read only" methods. This mapping is used to set transactions as "read only"
var Version = "dev"
Version represents the version of the server, the value is changed at build time
Functions ¶
func GetEnv ¶
GetEnv attempts to get an environment variable Every env var is prefixed by ORCHESTRATOR_
func GetEnvOrFallback ¶
GetEnvOrFallback attempts to get an environment variable or fallback to the provided default value. Every env var is prefixed by ORCHESTRATOR_.
func GetKeepAliveOptions ¶
func GetKeepAliveOptions() grpc.ServerOption
GetKeepAliveOptions will return server option with gRPC keepalive setup. This may panic on missing or invalid configuration env var.
func GetTLSOptions ¶
func GetTLSOptions() grpc.ServerOption
GetTLSOptions will return server option with optional TLS and mTLS setup. This may panic on missing or invalid configuration env var.
func MustGetEnv ¶
MustGetEnv extract environment variable or abort with an error message Every env var is prefixed with ORCHESTRATOR_
func MustGetEnvFlag ¶
MustGetEnvFlag extracts and environment variable and returns a boolean corresponding to its value ("true" is true, anything else is false). If the environment variable is not found, the program panics with an error message. Every env var is prefixed with "ORCHESTRATOR_".
func MustParseBool ¶
MustParseBool parse input as bool or log and exit
func MustParseDuration ¶
MustParseDuration parse input as a duration or log and exit.
func MustParseInt ¶
MustParseInt parse input as int or log and exit.
Types ¶
type AppParameters ¶
type AppParameters struct { GrpcOptions []grpc.ServerOption Config *OrchestratorConfiguration RetryBudget time.Duration }
AppParameters are settings used by the application.
type ContextualizedServerStream ¶
type ContextualizedServerStream struct { grpc.ServerStream // contains filtered or unexported fields }
func BindStreamToContext ¶
func BindStreamToContext(ctx context.Context, stream grpc.ServerStream) *ContextualizedServerStream
func (*ContextualizedServerStream) Context ¶
func (w *ContextualizedServerStream) Context() context.Context
type GrpcMethodChecker ¶
type GrpcMethodChecker struct{}
func (GrpcMethodChecker) IsEvaluateMethod ¶
func (c GrpcMethodChecker) IsEvaluateMethod(method string) bool
IsEvaluateMethod maps for each gRPC service its "read only" methods. Those are methods which should not have any side effect on the storage, ie: they should not write to the database or ledger. It is used to initiate read-only transactions when possible.
type MemoryQueue ¶
type MemoryQueue struct {
// contains filtered or unexported fields
}
MemoryQueue keeps events in memory
func (*MemoryQueue) Enqueue ¶
func (q *MemoryQueue) Enqueue(event *asset.Event) error
Enqueue adds an event to the queue
func (*MemoryQueue) GetEvents ¶
func (q *MemoryQueue) GetEvents() []*asset.Event
GetEvents returns queued events
type OrchestratorConfiguration ¶
type OrchestratorConfiguration struct { // map of channels -> organizations Channels map[string][]string `yaml:"channels"` }
OrchestratorConfiguration describe the business config of the server. Contrary to the technical conf item which are received as env var, some business details are passed as a yml config file.
func NewConfig ¶
func NewConfig(path string) *OrchestratorConfiguration
type OrgCACertList ¶
func GetOrgCACerts ¶
func GetOrgCACerts() (OrgCACertList, error)
GetOrgCACerts returns the valid CA keys per organization (mspid).
type TransactionChecker ¶
type TransactionChecker interface { // IsEvaluateMethod returns true if the gRPC method has no side effect (read-only). IsEvaluateMethod(method string) bool }
TransactionChecker is able to characterize a transaction based on the gRPC method.