types

package
v0.0.0-...-b7fd0f1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/carbynestack/ephemeral.

SPDX-License-Identifier: Apache-2.0

Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/carbynestack/ephemeral.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	// DiscoveryServiceStarted indicates the discovery service has started and ready to processIn events.
	DiscoveryServiceStarted = "DiscoveryServiceStarted"
	// GameProtocolError indicates an error in the protocol as a response to the message that were not delivered to the Game state machine.
	GameProtocolError = "GameProtocolError"
	// serviceEventsTopic represents the internal discovery service events.
	ServiceEventsTopic        = "serviceEvents"
	ClientIncomingEventsTopic = "clientIncomingEvents"
	ClientOutgoingEventsTopic = "clientOutgoingEvents"
	MasterOutgoingEventsTopic = "masterOutgoingEvents"
	DiscoveryTopic            = "discovery"
	// TODO: read this param from the config.
	Timeout = 20 * time.Second

	Init                      = "Init"
	Registering               = "Registering"
	Register                  = "Register"
	Registered                = "Registered"
	WaitPlayersReady          = "WaitPlayersReady"
	TCPCheck                  = "TCPCheck"
	TCPCheckSuccess           = "TCPCheckSuccess"
	TCPCheckFailure           = "TCPCheckFailure"
	Playing                   = "Playing"
	PlayerFinishedWithError   = "PlayerFinishedWithError"
	PlayerFinishedWithSuccess = "PlayerFinishedWithSuccess"
	PlayerReady               = "PlayerReady"
	PlayersReady              = "PlayersReady"
	GameIsReady               = "GameIsReady"
	GameError                 = "GameError"
	GameID                    = "gameID"
	PlayingError              = "PlayingError"
	PlayerDone                = "PlayerDone"
	ModeSlave                 = "slave"
	ModeMaster                = "master"

	GameFinishedWithSuccess = "GameFinishedWithSuccess"
	GameFinishedWithError   = "GameFinishedWithError"
	GameDone                = "GameDone"
	TCPCheckSuccessAll      = "TCPCheckSuccessAll"
	GameSuccess             = "GameSuccess"
	WaitTCPCheck            = "WaitTCPCheck"
	StateTimeoutError       = "StateTimeoutError"
	SecretShare             = "SECRETSHARE"
	PlainText               = "PLAINTEXT"
	AmphoraSecret           = "AMPHORASECRET"
	ConnID                  = "ConnID"
	EventScope              = "EventScope"
	EventScopeAll           = "EventScopeAll"
	EventScopeSelf          = "EventScropeSelf"
)

Variables

View Source
var (
	ActCtx   = contextKey("activation")
	SpdzCtx  = contextKey("spdz")
	ProxyCtx = contextKey("proxy")
)

Functions

This section is empty.

Types

type Activation

type Activation struct {
	AmphoraParams []string     `json:"amphoraParams"`
	SecretParams  []string     `json:"secretParams"`
	GameID        string       `json:"gameID"`
	Code          string       `json:"code"`
	Output        OutputConfig `json:"output"`
}

Activation is an object that is received as an input from the Ephemeral client.

type AmphoraConfig

type AmphoraConfig struct {
	Host   string `json:"host"`
	Scheme string `json:"scheme"`
	Path   string `json:"path"`
}

AmphoraConfig specifies the amphora host parameters.

type CtxConfig

type CtxConfig struct {
	Act     *Activation
	Spdz    *SPDZEngineTypedConfig
	Proxy   *ProxyConfig
	ErrCh   chan error
	Context context.Context
}

CtxConfig contains both execution and platform specific parameters.

type DiscoveryClient

type DiscoveryClient interface {
	Connect() (*grpc.ClientConn, error)
	Run(client pb.DiscoveryClient)
	GetIn() chan *pb.Event
	GetOut() chan *pb.Event
}

DiscoveryClient is an interface for discovery service client.

type DiscoveryConfig

type DiscoveryConfig struct {
	FrontendURL  string `json:"frontendURL"`
	MasterHost   string `json:"masterHost"`
	MasterPort   string `json:"masterPort"`
	Slave        bool   `json:"slave"`
	StateTimeout string `json:"stateTimeout"`
	Port         string `json:"port"`
	BusSize      int    `json:"busSize"`
	PortRange    string `json:"portRange"`
}

DiscoveryConfig represents the condig of discovery service.

type OutputConfig

type OutputConfig struct {
	Type string `json:"type"`
}

OutputConfig defines how the output of the app execution is treated.

type ProxyConfig

type ProxyConfig struct {
	Host      string `json:"host"`
	Port      string `json:"port"`
	LocalPort string `json:"localPort"`
}

ProxyConfig is the configuration used by the proxy when the connection between players is established.

type SPDZEngineConfig

type SPDZEngineConfig struct {
	RetrySleep       string        `json:"retrySleep"`
	RetryTimeout     string        `json:"retryTimeout"`
	Prime            string        `json:"prime"`
	RInv             string        `json:"rInv"`
	AmphoraConfig    AmphoraConfig `json:"amphoraConfig"`
	FrontendURL      string        `json:"frontendURL"`
	PlayerID         int32         `json:"playerID"`
	MaxBulkSize      int32         `json:"maxBulkSize"`
	DiscoveryAddress string        `json:"discoveryAddress"`
}

SPDZEngineConfig is the VPC specific configuration.

type SPDZEngineTypedConfig

type SPDZEngineTypedConfig struct {
	RetrySleep       time.Duration
	RetryTimeout     time.Duration
	Prime            big.Int
	RInv             big.Int
	AmphoraClient    amphora.AbstractClient
	PlayerID         int32
	FrontendURL      string
	MaxBulkSize      int32
	DiscoveryAddress string
}

SPDZEngineTypedConfig reflects SPDZEngineConfig, but it contains the real property types. We need this type, since the default json decoder doesn't know how to deserialize big.Int.

type WithBus

type WithBus interface {
	Bus() mb.MessageBus
}

WithBus is a type that contains a message bus.

Jump to

Keyboard shortcuts

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