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
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 ¶
- Variables
- func NewTopicFromPlayerID(ctx *CtxConfig) string
- func NewTransportClientFromDiverseConfigs(ioConfig *io.Config, ctx *CtxConfig, timeout time.Duration, ...) (*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 Wires
Constants ¶
This section is empty.
Variables ¶
var (
DoneTopic = "Done"
)
Functions ¶
func NewTopicFromPlayerID ¶
func NewTopicFromPlayerID(ctx *CtxConfig) string
NewTopicFromPlayerID converts player ID so it can be used as topic name.
Types ¶
type AbstractForwarder ¶
type AbstractForwarder interface {
Run() error
}
AbstractForwarder an interface for an entity that forwards events.
type AbstractPlayer ¶
type AbstractPlayer interface { Init(errCh chan error) Stop() History() *fsm.History Bus() mb.MessageBus PublishEvent(name, topic string, event *pb.Event) }
AbstractPlayer is an interface of a player.
type AbstractPlayerWithIO ¶
type AbstractPlayerWithIO interface {
Start()
}
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, 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, timeout time.Duration, me MPCEngine, playerParams *PlayerParams, 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) 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, conf *io.Config, pod string, spdz MPCEngine, errCh chan error, logger *zap.SugaredLogger) (*PlayerWithIO, error)
NewPlayerWithIO returns a new instance of PlayerWithIO.
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
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.
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.
func (*Server) CompilationHandler ¶
CompilationHandler parses the JSON payload and adds it to the request context.