foundry

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TxnFailedPrefix = "txn failed"
)

Variables

View Source
var (
	MaxMessageSize = 4 * 1024 * 1024
)
View Source
var NotFound error = fmt.Errorf("not found")
View Source
var (
	// Version is the package version
	Version = "undefined"
)

Functions

func Delete

func Delete(obj Object) error

func DeleteConfigs

func DeleteConfigs(ids []string) error

DeleteConfigs removes the machine configuration from the datastore

func DeleteObjects

func DeleteObjects(objs []Object) error

func Error

func Error(message string) error

Error creates an error, and logs it righteously

func ErrorE

func ErrorE(message string, err error) error

Encapsulate err in a structured log and return an abstracted high-level error with message as the payload

func ErrorEF

func ErrorEF(message string, err error, fields log.Fields) error

Encapsulate fields and err in a structured log and return an abstracted high-level error with message as the payload

func ErrorF

func ErrorF(message string, fields log.Fields) error

Encapsulate fields in a structured log and return an abstracted high-level error with message as the payload

func EtcdClient

func EtcdClient() (*clientv3.Client, error)

func EtcdConnect

func EtcdConnect() (*clientv3.Client, error)

Try up to 10 times to connect to etcd

func GRPCServerOptions added in v0.3.2

func GRPCServerOptions() []grpc.ServerOption

func GetConfigs

func GetConfigs(ids []string) ([]*api.MachineConfig, error)

GetConfigs retrieves the configuration from the datastore

func InitLogging

func InitLogging(logname string)

func IsTxnFailed

func IsTxnFailed(err error) bool

func ListConfigs

func ListConfigs() (map[string]*api.Config, error)

ListConfigs retrieves all machine configurations from the datastore

func Prepare

func Prepare(rq *api.ForgeRequest) (*api.MachineConfig, error)

func Read

func Read(obj Object) error

func ReadNew

func ReadNew(obj Object) error

func ReadObjects

func ReadObjects(objs []Object) (error, int)

func RunObjectTx

func RunObjectTx(otx ObjectTx) error

func SetConfigs

func SetConfigs(configs []*api.MachineConfig) error

SetConfigs configures foundry's datastore with machine configuration

func TxnFailed

func TxnFailed(message string) error

func Write

func Write(obj Object, opts ...etcd.OpOption) error

func WriteObjects

func WriteObjects(objs []Object, opts ...etcd.OpOption) error

Types

type Config

type Config struct {
	ManageEndpoint string     `yaml:"manage_endpoint"`
	EtcdEndpoint   string     `yaml:"etcd_endpoint"`
	EtcdTls        *TlsConfig `yaml:"etcd_tls"`
}

func LoadConfig

func LoadConfig() *Config

func ServerConfig

func ServerConfig() *Config

type Object

type Object interface {
	Key() string
	GetVersion() int64
	SetVersion(int64)
	Value() interface{}
}

all obejcts that go to and fro from the database implement this interface

type ObjectTx

type ObjectTx struct {
	Put    []Object
	Delete []Object
}

type TlsConfig

type TlsConfig struct {
	CA   string `key:"ca"`
	Cert string `yaml:"cert"`
	Key  string `yaml:"key"`
}

Jump to

Keyboard shortcuts

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