types

package
v0.0.0-...-7ce9f83 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 9

Documentation

Overview

Copyright (c) 2021-2023 - 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-2023 - 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"

	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"
	TupleType                 = "TupleType"
	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

This section is empty.

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 CastorConfig

type CastorConfig struct {
	Host       string `json:"host"`
	Scheme     string `json:"scheme"`
	Path       string `json:"path"`
	TupleStock int32  `json:"tupleStock"`
}

CastorConfig specifies the castor host and tuple stock parameters.

type CtxConfig

type CtxConfig struct {
	Act          *Activation
	Spdz         *SPDZEngineTypedConfig
	ProxyEntries []*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 DiscoveryClientConfig

type DiscoveryClientConfig struct {
	Port           string `json:"port"`
	Host           string `json:"host"`
	ConnectTimeout string `json:"connectTimeout"`
}

Config contains TCP connection properties of Carrier.

type DiscoveryClientTypedConfig

type DiscoveryClientTypedConfig struct {
	Port           string
	Host           string
	ConnectTimeout time.Duration
}

DiscoveryClientTypedConfig reflects DiscoveryClientConfig, but it contains the real property types.

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"`
	ComputationTimeout string `json:"computationTimeout"`
	ConnectTimeout     string `json:"connectTimeout"`
	Port               string `json:"port"`
	BusSize            int    `json:"busSize"`
	PortRange          string `json:"portRange"`
	PlayerCount        int    `json:"playerCount"`
}

DiscoveryConfig represents the config of discovery service.

type DiscoveryTypedConfig

type DiscoveryTypedConfig struct {
	FrontendURL        string
	MasterHost         string
	MasterPort         string
	Slave              bool
	StateTimeout       time.Duration
	ComputationTimeout time.Duration
	ConnectTimeout     time.Duration
	Port               string
	BusSize            int
	PortRange          string
	PlayerCount        int
}

DiscoveryTypedConfig reflects DiscoveryConfig, but it contains the real property types

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"`
	NetworkEstablishTimeout string `json:"networkEstablishTimeout"`
	Prime                   string `json:"prime"`
	RInv                    string `json:"rInv"`
	GfpMacKey               string `json:"gfpMacKey"`
	Gf2nMacKey              string `json:"gf2nMacKey"`
	Gf2nBitLength           int32  `json:"gf2nBitLength"`
	// Gf2nStorageSize represents the size in bytes for each gf2n element e.g. depending on the 'USE_GF2N_LONG' flag
	// being set when compiling SPDZ where storage size is 16 for USE_GF2N_LONG=1, or 8 if set to 0
	Gf2nStorageSize    int32                 `json:"gf2nStorageSize"`
	PrepFolder         string                `json:"prepFolder"`
	AmphoraConfig      AmphoraConfig         `json:"amphoraConfig"`
	CastorConfig       CastorConfig          `json:"castorConfig"`
	FrontendURL        string                `json:"frontendURL"`
	PlayerID           int32                 `json:"playerID"`
	PlayerCount        int32                 `json:"playerCount"`
	MaxBulkSize        int32                 `json:"maxBulkSize"`
	DiscoveryConfig    DiscoveryClientConfig `json:"discoveryConfig"`
	StateTimeout       string                `json:"stateTimeout"`
	ComputationTimeout string                `json:"computationTimeout"`
}

SPDZEngineConfig is the VPC specific configuration.

type SPDZEngineTypedConfig

type SPDZEngineTypedConfig struct {
	RetrySleep              time.Duration
	NetworkEstablishTimeout time.Duration
	Prime                   big.Int
	RInv                    big.Int
	GfpMacKey               big.Int
	Gf2nMacKey              string
	Gf2nBitLength           int32
	Gf2nStorageSize         int32
	PrepFolder              string
	AmphoraClient           amphora.AbstractClient
	CastorClient            castor.AbstractClient
	TupleStock              int32
	PlayerID                int32
	PlayerCount             int32
	FrontendURL             string
	MaxBulkSize             int32
	DiscoveryConfig         DiscoveryClientTypedConfig
	StateTimeout            time.Duration
	ComputationTimeout      time.Duration
}

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