shared

package
v0.0.0-...-4d07d55 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 11, 2019 License: GPL-3.0 Imports: 6 Imported by: 16

Documentation

Index

Constants

View Source
const (
	FeatureStorage    = "storage"
	FeatureFunctionRT = "funtion"
	FeatureServiceRT  = "service"
	FeatureRegistry   = "registry"
)
View Source
const (
	NotFoundPage = "" /* 1420-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetLink struct {
	// Addresses  []string
	// ProviderID string
	AssetID noid.Identifier
	Size    int64
}

type ControllerInterface

type ControllerInterface interface {
	Init() error
	GetFunctionInfo(ID noid.Identifier) (FunctionInfo, error)
	GetAssetLink(ID noid.Identifier) (string, error)
	DeployPkg(pkg *multipart.FileHeader) error
	APIHandler(*http.Request, []string) ([]byte, error)
	GetNodeVersion() NodeVersion
	HandleMessage(msg *NetMsg) error
	Version() int
}

type DBPatch

type DBPatch struct {
	Key  string
	Data interface{}
}

type DatabaseCacheInterface

type DatabaseCacheInterface interface {
	Init(dbname string, dbpath string) error
	Export(path string) error
	Put(key string, value interface{}, timeout int, overwrite bool) error
	Batch([]DBPatch) error
	Get(key string) (interface{}, int, error)
	Delete(key string) error
}

type DatabasePersistentInterface

type DatabasePersistentInterface interface {
	Init(dbname string, dbpath string) error
	Export(path string) error
	Put(key string, value []byte, overwrite bool) error
	Batch([]DBPatch) error
	Get(key string) ([]byte, error)
	Delete(key string) error
}

type DatabaseType

type DatabaseType string
const (
	DatabasePersistent DatabaseType = "persist"
	DatabaseCache      DatabaseType = "cache"
)

type FunctionInfo

type FunctionInfo struct {
	ID          noid.Identifier
	RuntimeType schema.RuntimeType
	Local       bool
	Owner       string
	OwnerSig    string
}

type LoggerInterface

type LoggerInterface interface {
	Init(packagename string) error
	Log(string)
	Debug(string)
	Fatal(error)
}

type NetMsg

type NetMsg struct {
	ReceiveFrom string
	SenderType  nna.NodeType
	MsgData     schema.Msg
}

type NetworkInterface

type NetworkInterface interface {
	Init() error
	BroadcastMsgToProviders(*NetMsg) error
	GetProviderAddresses(string) []string
	GetProviderList() []ProviderInfo
	SendMsgToClient(*schema.Msg, string) error
	SendMsgToProvider(*schema.Msg, string) error
	GetAvailableNodeTypes() []nna.NodeType
	GetAvailableConnectionTypes() []nna.ConnectionType
	GetAvailableConnectionProtocolTypes() []nna.ConnectionProtocolType
	Version() int
}

type NodeCfg

type NodeCfg struct {
	Info         *NodeInfo
	Network      NetworkInterface
	Controler    ControllerInterface
	Runtime      RuntimeInterface
	Pubsub       PubsubInterface
	DBCache      DatabaseCacheInterface
	DBPersistent DatabasePersistentInterface
}

type NodeInfo

type NodeInfo struct {
	ID  string
	Cfg *YamlConfigure
}

type NodeVersion

type NodeVersion struct {
	Controller int
	Network    int
	Runtime    int
}

type PackageData

type PackageData struct {
	MetaData YamlPackageMetaData
	Files    map[string]*zip.File
}

type ProviderInfo

type ProviderInfo struct {
	ProviderID string
	Addresses  []string
	Version    NodeVersion
	Owner      string
	Reachable  bool
}

type PubsubInterface

type PubsubInterface interface {
	Init() error
	ProcessCmd(buf []byte, msgID string, subscriber string, subscriberCh chan interface{})
}

type RequestInfo

type RequestInfo struct {
	RequestorType schema.NodeType
	Type          schema.MsgType
	Requestor     string
	RequestCtx    interface{}
}

type RespondMsg

type RespondMsg struct {
	Msg    schema.Msg
	Sender string
}

type RuntimeInterface

type RuntimeInterface interface {
	Init() error
	RunFunction(fnLink string, fnType schema.RuntimeType, data []byte) (*RuntimeOutput, error)
	StartService() error
	Version() int
}

type RuntimeOutput

type RuntimeOutput struct {
	Status bool
	Result string
	Logs   []string
}

type YamlAssetPolicy

type YamlAssetPolicy struct {
	MaxAssetSize uint64 `yaml:"max-asset-size"`
	Retriever    struct {
		MaxConnPerFile            int `yaml:"max-conn-per-file"`
		MaxConconcurrentRetriever int `yaml:"max-concurrent-retriever"`
	} `yaml:"retriever"`
	Uploader struct {
		MaxConcurrentUploader int `yaml:"max-concurrent-uploader"`
	} `yaml:"uploader"`
}

type YamlConfigure

type YamlConfigure struct {
	Version       int            `yaml:"version"`
	NetworkID     int            `yaml:"network-id"`
	Modules       []string       `yaml:"modules"`
	Identity      string         `yaml:"identity"`
	Owner         string         `yaml:"owner"`
	DataDir       string         `yaml:"datadir"`
	Debug         bool           `yaml:"debug"`
	DebugRuntime  bool           `yaml:"debug-runtime"`
	Network       YamlNetworkCfg `yaml:"network"`
	Policy        YamlPolicyCfg  `yaml:"policy"`
	Logger        YamlLogCfg     `yaml:"log-config"`
	RegistriesDir string         `yaml:"registries-dir"`
}

type YamlLogCfg

type YamlLogCfg struct {
	Logger struct {
		Endpoint     string `yaml:"endpoint"`
		EndpointType string `yaml:"endpoint-type"`
	} `yaml:"logger"`
	Functional struct {
		Enable   bool   `yaml:"enable"`
		Endpoint string `yaml:"endpoint"`
	} `yaml:"functional"`
	Service struct {
		Enable   bool   `yaml:"enable"`
		Endpoint string `yaml:"endpoint"`
	} `yaml:"service"`
}

type YamlNetworkCfg

type YamlNetworkCfg struct {
	Port           int      `yaml:"port"`
	APIPort        int      `yaml:"api-port"`
	BroadcastAddrs []string `yaml:"broadcast-addrs"`
	InitProviders  []string `yaml:"init-peers"`
	LinkNodes      []string `yaml:"link-nodes"`
}

type YamlNetworkPolicy

type YamlNetworkPolicy struct {
	Providers struct {
		Min     int `yaml:"min"`
		Max     int `yaml:"max"`
		Latency int `yaml:"latency"`
	} `yaml:"providers"`
	Clients struct {
		Max     int `yaml:"max"`
		Latency int `yaml:"latency"`
	} `yaml:"clients"`
}

type YamlPackageMetaData

type YamlPackageMetaData struct {
	Version  int    `yaml:"version"`
	Owner    string `yaml:"owner"`
	OwnerSig string `yaml:"owner-sig"`
	Files    struct {
		Functionals []string `yaml:"functionals"`
		Services    []string `yaml:"services"`
		Assets      []string `yaml:"assets"`
	} `yaml:"files"`
}

type YamlPolicyCfg

type YamlPolicyCfg struct {
	AssetPolicy   YamlAssetPolicy   `yaml:"asset"`
	RuntimePolicy YamlRuntimePolicy `yaml:"runtime"`
	NetworkPolicy YamlNetworkPolicy `yaml:"network"`
}

type YamlRuntimePolicy

type YamlRuntimePolicy struct {
	MaxRunningService int `yaml:"max-running-service"`
	MaxConCurrentCall struct {
		Service  int `yaml:"service"`
		Function int `yaml:"function"`
	} `yaml:"max-concurrent-calls"`
	AllowRuntimeTypes []string `yaml:"allow-runtime-types"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL