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-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
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 ¶
- func DefaultCastorTupleStreamerFactory(l *zap.SugaredLogger, tt castor.TupleType, conf *SPDZEngineTypedConfig, ...) (TupleStreamer, error)
- func NewTopicFromPlayerID(ctx *CtxConfig) string
- func NewTransportClientFromDiverseConfigs(dcConf *DiscoveryClientTypedConfig, ctx *CtxConfig, logger *zap.SugaredLogger, ...) (*c.Client, error)
- type AbstractForwarder
- type AbstractPlayer
- type AbstractPlayerWithIO
- type Callbacker
- type Forwarder
- type ForwarderConf
- type MPCEngine
- type Player1
- type PlayerParams
- type PlayerWithIO
- type SPDZEngine
- type SPDZWrapper
- type Server
- type TupleStreamerFactory
- type Wires
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultCastorTupleStreamerFactory ¶
func DefaultCastorTupleStreamerFactory(l *zap.SugaredLogger, tt castor.TupleType, conf *SPDZEngineTypedConfig, playerDataDir string, gameID uuid.UUID, threadNr int) (TupleStreamer, error)
DefaultCastorTupleStreamerFactory default implementation of TupleStreamerFactory creating new io.CastorTupleStreamer
func NewTopicFromPlayerID ¶
func NewTopicFromPlayerID(ctx *CtxConfig) string
NewTopicFromPlayerID converts player ID so it can be used as topic name.
func NewTransportClientFromDiverseConfigs ¶
func NewTransportClientFromDiverseConfigs(dcConf *DiscoveryClientTypedConfig, ctx *CtxConfig, logger *zap.SugaredLogger, ch *Wires) (*c.Client, error)
NewTransportClientFromDiverseConfigs returns a new transport client.
Types ¶
type AbstractForwarder ¶
type AbstractForwarder interface {
Run() error
}
AbstractForwarder an interface for an entity that forwards events.
type AbstractPlayer ¶
type AbstractPlayer interface { Init() Stop() History() *fsm.History Bus() mb.MessageBus PublishEvent(name, topic string, event *pb.Event) }
AbstractPlayer is an interface of a player.
type AbstractPlayerWithIO ¶
AbstractPlayerWithIO is an interface type for a PlayerWithIO.
type Callbacker ¶
type Callbacker struct {
// contains filtered or unexported fields
}
Callbacker preserves callback functions used in Player FSM.
func NewCallbacker ¶
func NewCallbacker(bus mb.MessageBus, playerParams *PlayerParams, errCh chan error, logger *zap.SugaredLogger) *Callbacker
NewCallbacker returns a new instance of callbacker
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwarder forwards events from/out an FSM.
func NewForwarder ¶
func NewForwarder(conf *ForwarderConf) *Forwarder
NewForwarder returns a new forwarder.
type ForwarderConf ¶
type ForwarderConf struct { Logger *zap.SugaredLogger Ctx context.Context Player *Player1 InCh chan *pb.Event OutCh chan *pb.Event Topic string }
ForwarderConf is the configuration of the event forwarder.
type Player1 ¶
type Player1 struct {
// contains filtered or unexported fields
}
Player1 stores the FSM of the player, it manages the state and runs callbacks as response on internal/external events. The events are communicated via in-memory message bus with 2 topics: "discovery" topic is used to transmit events from player to discovery service. "playerN" topic name corresponds to the name of the player. And is used for events from discovery to the player and from the player to itself.
func NewPlayer ¶
func NewPlayer(ctx context.Context, bus mb.MessageBus, stateTimeout time.Duration, computationTimeout time.Duration, me MPCEngine, playerParams *PlayerParams, errCh chan error, logger *zap.SugaredLogger) (*Player1, error)
NewPlayer returns an fsm based model of the MPC player.
func (*Player1) Bus ¶
func (p *Player1) Bus() mb.MessageBus
Bus returns in internal message bus to comply with FSMWithBus interface.
func (*Player1) Init ¶
func (p *Player1) Init()
Init starts FSM and triggers the registration of the player.
func (*Player1) PublishEvent ¶
PublishEvent publishes an external event into player's state machine.
type PlayerParams ¶
type PlayerParams struct { GameID string Pod string PlayerID, Players int32 // Address of the frontend gateway (e.g. Istio). IP string Name string }
PlayerParams defines parameters of the player.
type PlayerWithIO ¶
type PlayerWithIO struct { Forwarder AbstractForwarder Player AbstractPlayer Wires *Wires Client c.TransportClient }
PlayerWithIO contains the forwarder, player FSM, wires with input and output channels and discovery client.
func NewPlayerWithIO ¶
func NewPlayerWithIO(ctx *CtxConfig, dcConf *DiscoveryClientTypedConfig, pod string, spdz MPCEngine, stateTimeout time.Duration, computationTimeout time.Duration, errCh chan error, logger *zap.SugaredLogger) (*PlayerWithIO, error)
NewPlayerWithIO returns a new instance of PlayerWithIO.
func (*PlayerWithIO) History ¶
func (p *PlayerWithIO) History() *fsm.History
History returns the fsm.History of the game's statemachine.
func (*PlayerWithIO) Start ¶
func (p *PlayerWithIO) Start()
Start activates the state machine of the player.
type SPDZEngine ¶
type SPDZEngine struct {
// contains filtered or unexported fields
}
SPDZEngine compiles, executes, provides IO operations for SPDZ based runtimes.
func NewSPDZEngine ¶
func NewSPDZEngine(logger *zap.SugaredLogger, cmder Executor, config *SPDZEngineTypedConfig) (*SPDZEngine, error)
NewSPDZEngine returns a new instance of SPDZ engine that knows how to compile and trigger an execution of SPDZ runtime.
func (*SPDZEngine) Activate ¶
func (s *SPDZEngine) Activate(ctx *CtxConfig) ([]byte, error)
Activate starts a proxy, writes an IP file, start SPDZ execution, unpacks inputs parameters, sends them to the runtime and waits for the response.
func (*SPDZEngine) Compile ¶
func (s *SPDZEngine) Compile(ctx *CtxConfig) error
Compile compiles a SPDZ application and returns the number of threads declared by the program.
type SPDZWrapper ¶
type SPDZWrapper struct {
// contains filtered or unexported fields
}
SPDZWrapper starts the computation and reads the output parameters. It is also used to update player's proxy configuration based on the discovery output.
func NewSPDZWrapper ¶
func NewSPDZWrapper(ctx *CtxConfig, respCh chan []byte, errCh chan error, logger *zap.SugaredLogger, act func(*CtxConfig) ([]byte, error)) *SPDZWrapper
NewSPDZWrapper returns a new SPDZ wrapper.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a HTTP server which wraps the handling of incoming requests that trigger the MPC computation.
func NewServer ¶
func NewServer(compile func(*CtxConfig) error, activate func(*CtxConfig) ([]byte, error), logger *zap.SugaredLogger, config *SPDZEngineTypedConfig) *Server
NewServer returns a new server.
func (*Server) ActivationHandler ¶
func (s *Server) ActivationHandler(writer http.ResponseWriter, req *http.Request)
ActivationHandler is the http handler starts the Player FSM.
func (*Server) BodyFilter ¶
BodyFilter verifies all necessary parameters are set in the request body. Also sets the CtxConfig to the request
func (*Server) CompilationHandler ¶
CompilationHandler parses the JSON payload and adds it to the request context.
type TupleStreamerFactory ¶
type TupleStreamerFactory func(l *zap.SugaredLogger, tt castor.TupleType, conf *SPDZEngineTypedConfig, playerDataDir string, gameID uuid.UUID, threadNr int) (TupleStreamer, error)
TupleStreamerFactory is a factory method to create new io.TupleStreamer.
It accepts a logger, the type of tuples it provides, the spdz config, path to the player data base directory, the game ID, as well as the thread it serves. It either returns a pointer to the new TupleStreamer or an error if creation failed.