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 - 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 - 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 Assert(event string, f FSMWithBus, done chan struct{}, assert func([]string), ...)
- func GenerateEvents(name string, IDs ...string) []*pb.Event
- func WaitDoneOrTimeout(done chan struct{}, t ...time.Duration)
- type BrokenNetworkChecker
- type BrokenSPDZEngine
- type Event
- type FSMWithBus
- type FakeBrokenDiscoveryClient
- type FakeDClient
- type FakeDiscoveryClient
- type FakeNetworker
- type FakeTransport
- type Game
- type GameCallbacker
- type GamesWithBus
- type IstioNetworker
- type Networker
- type PlayerID
- type PortsState
- type Publisher
- type ServiceNG
- type StatesAsserter
Constants ¶
This section is empty.
Variables ¶
var ( // BasePort is the base for the port number that is used by the proxy. BasePort = int32(5000) )
Functions ¶
func Assert ¶
func Assert(event string, f FSMWithBus, done chan struct{}, assert func([]string), topic ...string)
Assert subscribes for a topic in the message bus, waits until the 'event' received, executes the assertions and signals to the done channel once finished. if no assetions are specified, it just verifies that the event was received.
func GenerateEvents ¶
GenerateEvents id is a helper method to generate a list of events produced by discovery clients.
func WaitDoneOrTimeout ¶
WaitDoneOrTimeout waits until either something came from the done channel or a timeout occured
Types ¶
type BrokenNetworkChecker ¶
type BrokenNetworkChecker struct { }
func (*BrokenNetworkChecker) Verify ¶
func (f *BrokenNetworkChecker) Verify(host, port string) error
type BrokenSPDZEngine ¶
type BrokenSPDZEngine struct { }
type FSMWithBus ¶
type FSMWithBus interface { History() *fsm.History Bus() mb.MessageBus }
FSMWithBus is a Finate State Machine coupled with message bus.
type FakeBrokenDiscoveryClient ¶
type FakeBrokenDiscoveryClient struct {
// contains filtered or unexported fields
}
func NewFakeBrokenDiscoveryClient ¶
func NewFakeBrokenDiscoveryClient(bus mb.MessageBus, name string, registered, playersReady bool) *FakeBrokenDiscoveryClient
func (*FakeBrokenDiscoveryClient) GetIn ¶
func (fbdc *FakeBrokenDiscoveryClient) GetIn() chan *pb.Event
GetIn returns In channel of the client.
func (*FakeBrokenDiscoveryClient) GetOut ¶
func (fbdc *FakeBrokenDiscoveryClient) GetOut() chan *pb.Event
GetOut returns Out channel of the client.
func (*FakeBrokenDiscoveryClient) Run ¶
func (fbdc *FakeBrokenDiscoveryClient) Run()
type FakeDClient ¶
type FakeDClient struct { }
FakeDClient is used in the tests.
func (*FakeDClient) Connect ¶
func (f *FakeDClient) Connect() (*grpc.ClientConn, error)
Connect belongs to a fake, it is used in the tests.
func (*FakeDClient) GetIn ¶
func (f *FakeDClient) GetIn() chan *pb.Event
GetIn returns In channel of the client.
func (*FakeDClient) GetOut ¶
func (f *FakeDClient) GetOut() chan *pb.Event
GetOut returns Out channel of the client.
func (*FakeDClient) Run ¶
func (f *FakeDClient) Run(client pb.DiscoveryClient)
Run belongs to a fake struct, it is not really used.
type FakeDiscoveryClient ¶
type FakeDiscoveryClient struct {
// contains filtered or unexported fields
}
func NewFakeDiscoveryClient ¶
func NewFakeDiscoveryClient(bus mb.MessageBus, name string) *FakeDiscoveryClient
func (*FakeDiscoveryClient) GetIn ¶
func (fdc *FakeDiscoveryClient) GetIn() chan *pb.Event
GetIn returns In channel of the client.
func (*FakeDiscoveryClient) GetOut ¶
func (fdc *FakeDiscoveryClient) GetOut() chan *pb.Event
GetOut returns Out channel of the client.
func (*FakeDiscoveryClient) Run ¶
func (fdc *FakeDiscoveryClient) Run()
type FakeNetworker ¶
type FakeNetworker struct {
FreePorts []int32
}
func (*FakeNetworker) CreateNetwork ¶
func (f *FakeNetworker) CreateNetwork(pl *pb.Player) (int32, error)
type FakeTransport ¶
type FakeTransport struct { }
func (*FakeTransport) Events ¶
func (t *FakeTransport) Events(stream pb.Discovery_EventsServer) error
func (*FakeTransport) GetIn ¶
func (t *FakeTransport) GetIn() chan *pb.Event
func (*FakeTransport) GetOut ¶
func (t *FakeTransport) GetOut() chan *pb.Event
func (*FakeTransport) Run ¶
func (t *FakeTransport) Run(f func()) error
func (*FakeTransport) Stop ¶
func (t *FakeTransport) Stop()
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game is a single execution of MPC.
type GameCallbacker ¶
type GameCallbacker struct {
// contains filtered or unexported fields
}
GameCallbacker contains methods to react on game events.
type GamesWithBus ¶
type GamesWithBus struct { Games map[string]*Game Bus mb.MessageBus }
GamesWithBus is tuple of Game and MessageBus
type IstioNetworker ¶
type IstioNetworker struct {
// contains filtered or unexported fields
}
IstioNetworker is an implementation of Networker interface which creates new networks backed by Istio configuration.
func NewIstioNetworker ¶
func NewIstioNetworker(logger *zap.SugaredLogger, portRange string, delCh chan string) (*IstioNetworker, error)
NewIstioNetworker creates a new IstioNetworker
func (*IstioNetworker) CreateNetwork ¶
func (i *IstioNetworker) CreateNetwork(pl *pb.Player) (int32, error)
CreateNetwork creates a network in the format acceptable by the network controller.
func (*IstioNetworker) Run ¶
func (i *IstioNetworker) Run() error
Run starts the Networker. This method initializes k8s informers and synchorinizes various caches. It also registers a callback which will clean up the resources after pod deletion.
type Networker ¶
Networker is an interface that allows to retrieve ports and create network config for MPC apps.
type PortsState ¶
type PortsState struct {
// contains filtered or unexported fields
}
func NewPortsState ¶
func NewPortsState(rng string, used []int32) (*PortsState, error)
func (*PortsState) GetFreePort ¶
func (m *PortsState) GetFreePort() (int32, error)
GetFreePort returns a port that can be assigned or an error if there are no free ports.
func (*PortsState) Sync ¶
func (m *PortsState) Sync(used []int32) error
Sync updates the state based on the currently used ports. It populates the list of released ports and updates the lastUsed pointer. Not thead safe, an external lock must be hold to execute this method.
type Publisher ¶
type Publisher struct { Fsm *fsm.FSM Bus mb.MessageBus }
Publisher sends an event to the message bus.
func NewPublisher ¶
func NewPublisher(bus mb.MessageBus) *Publisher
NewPublisher returns a new publisher.
func (*Publisher) Publish ¶
Publish sends an FSM event to a given topic of the message bus. Not every call to Publish will have an srcTopic, thus make it of variable size.
func (*Publisher) PublishExternalEvent ¶
PublishExternalEvent publishes an instance of Event as received from the external source.
type ServiceNG ¶
type ServiceNG struct {
// contains filtered or unexported fields
}
ServiceNG is a new generation of discovery service.
func NewServiceNG ¶
func NewServiceNG(bus mb.MessageBus, pub *Publisher, stateTimeout time.Duration, computationTimeout time.Duration, tr t.Transport, n Networker, frontendAddress string, logger *zap.SugaredLogger, mode string, client DiscoveryClient, playerCount int) *ServiceNG
NewServiceNG returns a new instance of discovery service.
func (*ServiceNG) DeleteCallback ¶
DeleteCallback is called when the pod is deleted, so we remove it from our bookkeeping.
type StatesAsserter ¶
type StatesAsserter struct {
// contains filtered or unexported fields
}
StatesAsserter allows checking for returned states from a Game more easily
func NewStatesAsserter ¶
func NewStatesAsserter(states []string) *StatesAsserter
NewStatesAsserter creates a new StatesAsserter that checks the provided states slice
func (*StatesAsserter) ExpectNext ¶
func (s *StatesAsserter) ExpectNext() Assertion
ExpectNext returns an Assertion over the next element of the internal states slice.
This method does not perform any bounds checking, so calling this one time too many will panic