Documentation ¶
Overview ¶
Package helium is the main entrypoint to the Helium library. It provides function to configure and run a Helium helper server and Helium clients.
Index ¶
- Constants
- type Dialer
- type HeliumClient
- func (hc *HeliumClient) Connect() error
- func (hc *HeliumClient) ConnectWithDialer(dialer Dialer) error
- func (hc *HeliumClient) Disconnect() error
- func (hc *HeliumClient) GetAggregationOutput(ctx context.Context, pd protocols.Descriptor) (*protocols.AggregationOutput, error)
- func (hc *HeliumClient) GetCiphertext(ctx context.Context, ctID sessions.CiphertextID) (*sessions.Ciphertext, error)
- func (s *HeliumClient) GetStats() NetStats
- func (s *HeliumClient) HandleConn(_ context.Context, sta stats.ConnStats)
- func (s *HeliumClient) HandleRPC(ctx context.Context, sta stats.RPCStats)
- func (hc *HeliumClient) IncomingShares() <-chan protocols.Share
- func (hc *HeliumClient) NodeID() sessions.NodeID
- func (hc *HeliumClient) OutgoingShares() chan<- protocols.Share
- func (hc *HeliumClient) PutCiphertext(ctx context.Context, ct sessions.Ciphertext) error
- func (hc *HeliumClient) PutShare(ctx context.Context, share protocols.Share) error
- func (hc *HeliumClient) Register(ctx context.Context) (upstream *coordinator.Channel[node.Event], present int, err error)
- func (hc *HeliumClient) Run(ctx context.Context, app node.App, ip compute.InputProvider) (outs <-chan circuits.Output, err error)
- func (s *HeliumClient) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
- func (s *HeliumClient) TagRPC(ctx context.Context, _ *stats.RPCTagInfo) context.Context
- type HeliumServer
- func (hsv *HeliumServer) AppendEventToLog(event node.Event)
- func (hsv *HeliumServer) CloseEventLog()
- func (hsv *HeliumServer) GetAggregationOutput(inctx context.Context, apipd *pb.ProtocolDescriptor) (*pb.AggregationOutput, error)
- func (hsv *HeliumServer) GetCiphertext(inctx context.Context, ctid *pb.CiphertextID) (*pb.Ciphertext, error)
- func (hsv *HeliumServer) GetOperand(opl circuits.OperandLabel) (*circuits.Operand, bool)
- func (s *HeliumServer) GetStats() NetStats
- func (s *HeliumServer) HandleConn(_ context.Context, sta stats.ConnStats)
- func (s *HeliumServer) HandleRPC(ctx context.Context, sta stats.RPCStats)
- func (hsv *HeliumServer) Logf(msg string, v ...any)
- func (hsv *HeliumServer) PutCiphertext(inctx context.Context, apict *pb.Ciphertext) (*pb.CiphertextID, error)
- func (hsv *HeliumServer) PutOperand(opl circuits.OperandLabel, op *circuits.Operand) error
- func (hsv *HeliumServer) PutShare(inctx context.Context, apiShare *pb.Share) (*pb.Void, error)
- func (hsv *HeliumServer) Register(_ *pb.Void, stream pb.Helium_RegisterServer) error
- func (hsv *HeliumServer) Run(ctx context.Context, app node.App, ip compute.InputProvider) (cdescs chan<- circuits.Descriptor, outs <-chan circuits.Output, err error)
- func (s *HeliumServer) TagConn(ctx context.Context, _ *stats.ConnTagInfo) context.Context
- func (s *HeliumServer) TagRPC(ctx context.Context, _ *stats.RPCTagInfo) context.Context
- type NetStats
- type ServiceStats
Constants ¶
const ( MaxMsgSize = 1024 * 1024 * 32 KeepaliveTime = time.Second KeepaliveTimeout = time.Second )
const (
ClientConnectTimeout = 3 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeliumClient ¶ added in v0.2.0
type HeliumClient struct { sessions.PublicKeyProvider *grpc.ClientConn pb.HeliumClient // contains filtered or unexported fields }
HeliumClient is a client for the helium service. It is used by peer nodes to communicate with the helium server.
func NewHeliumClient ¶ added in v0.2.0
func NewHeliumClient(node *node.Node, helperID sessions.NodeID, helperAddress node.Address) *HeliumClient
NewHeliumClient creates a new helium client.
func RunHeliumClient ¶ added in v0.2.0
func (*HeliumClient) Connect ¶ added in v0.2.0
func (hc *HeliumClient) Connect() error
Connect establishes a connection to the helium server.
func (*HeliumClient) ConnectWithDialer ¶ added in v0.2.0
func (hc *HeliumClient) ConnectWithDialer(dialer Dialer) error
ConnectWithDialer establishes a connection to the helium server using the provided dialer.
func (*HeliumClient) Disconnect ¶ added in v0.2.0
func (hc *HeliumClient) Disconnect() error
func (*HeliumClient) GetAggregationOutput ¶ added in v0.2.0
func (hc *HeliumClient) GetAggregationOutput(ctx context.Context, pd protocols.Descriptor) (*protocols.AggregationOutput, error)
GetAggregationOutput queries and returns the aggregation output for a given protocol descriptor.
func (*HeliumClient) GetCiphertext ¶ added in v0.2.0
func (hc *HeliumClient) GetCiphertext(ctx context.Context, ctID sessions.CiphertextID) (*sessions.Ciphertext, error)
GetCiphertext queries and returns a ciphertext.
func (*HeliumClient) HandleConn ¶ added in v0.2.0
HandleConn processes the Conn stats.
func (*HeliumClient) IncomingShares ¶ added in v0.2.0
func (hc *HeliumClient) IncomingShares() <-chan protocols.Share
func (*HeliumClient) NodeID ¶ added in v0.2.0
func (hc *HeliumClient) NodeID() sessions.NodeID
func (*HeliumClient) OutgoingShares ¶ added in v0.2.0
func (hc *HeliumClient) OutgoingShares() chan<- protocols.Share
func (*HeliumClient) PutCiphertext ¶ added in v0.2.0
func (hc *HeliumClient) PutCiphertext(ctx context.Context, ct sessions.Ciphertext) error
PutCiphertext sends a ciphertext to the helium server.
func (*HeliumClient) Register ¶ added in v0.2.0
func (hc *HeliumClient) Register(ctx context.Context) (upstream *coordinator.Channel[node.Event], present int, err error)
Register registers the client with the helium server and returns a channel for receiving events. It returns the current sequence number for the event log as present. Reading present+1 events from the returned channel will not block for longer than network-introduced delays.
func (*HeliumClient) Run ¶ added in v0.2.0
func (hc *HeliumClient) Run(ctx context.Context, app node.App, ip compute.InputProvider) (outs <-chan circuits.Output, err error)
func (*HeliumClient) TagConn ¶ added in v0.2.0
TagConn can attach some information to the given context. The returned context will be used for stats handling. For conn stats handling, the context used in HandleConn for this connection will be derived from the context returned. For RPC stats handling,
- On server side, the context used in HandleRPC for all RPCs on this connection will be derived from the context returned.
- On client side, the context is not derived from the context returned.
type HeliumServer ¶ added in v0.2.0
type HeliumServer struct { sessions.PublicKeyProvider // grpc API *grpc.Server *pb.UnimplementedHeliumServer // contains filtered or unexported fields }
HeliumServer is the server-side of the helium transport. In the current implementation, the server is responsible for keeping the event log and a server cannot be restarted after it is closed. // TODO
func NewHeliumServer ¶ added in v0.2.0
func NewHeliumServer(helperNode *node.Node) *HeliumServer
NewHeliumServer creates a new helium server with the provided node information and handlers.
func RunHeliumServer ¶ added in v0.2.0
func (*HeliumServer) AppendEventToLog ¶ added in v0.2.0
func (hsv *HeliumServer) AppendEventToLog(event node.Event)
AppendEventToLog is called by the server side to append a new event to the log and send it to all connected peers.
func (*HeliumServer) CloseEventLog ¶ added in v0.2.0
func (hsv *HeliumServer) CloseEventLog()
CloseEventLog is called by the server side to close the event log and stop sending events to connected peers.
func (*HeliumServer) GetAggregationOutput ¶ added in v0.2.0
func (hsv *HeliumServer) GetAggregationOutput(inctx context.Context, apipd *pb.ProtocolDescriptor) (*pb.AggregationOutput, error)
GetAggregationOutput is a gRPC handler for the GetAggregationOutput method of the Helium service.
func (*HeliumServer) GetCiphertext ¶ added in v0.2.0
func (hsv *HeliumServer) GetCiphertext(inctx context.Context, ctid *pb.CiphertextID) (*pb.Ciphertext, error)
GetCiphertext is a gRPC handler for the GetCiphertext method of the Helium service.
func (*HeliumServer) GetOperand ¶ added in v0.2.0
func (hsv *HeliumServer) GetOperand(opl circuits.OperandLabel) (*circuits.Operand, bool)
func (*HeliumServer) HandleConn ¶ added in v0.2.0
HandleConn processes the Conn stats.
func (*HeliumServer) Logf ¶ added in v0.2.0
func (hsv *HeliumServer) Logf(msg string, v ...any)
func (*HeliumServer) PutCiphertext ¶ added in v0.2.0
func (hsv *HeliumServer) PutCiphertext(inctx context.Context, apict *pb.Ciphertext) (*pb.CiphertextID, error)
PutCiphertext is a gRPC handler for the PutCiphertext method of the Helium service.
func (*HeliumServer) PutOperand ¶ added in v0.2.0
func (hsv *HeliumServer) PutOperand(opl circuits.OperandLabel, op *circuits.Operand) error
func (*HeliumServer) PutShare ¶ added in v0.2.0
PutShare is a gRPC handler for the PutShare method of the Helium service.
func (*HeliumServer) Register ¶ added in v0.2.0
func (hsv *HeliumServer) Register(_ *pb.Void, stream pb.Helium_RegisterServer) error
Register is a gRPC handler for the Register method of the Helium service.
func (*HeliumServer) Run ¶ added in v0.2.0
func (hsv *HeliumServer) Run(ctx context.Context, app node.App, ip compute.InputProvider) (cdescs chan<- circuits.Descriptor, outs <-chan circuits.Output, err error)
func (*HeliumServer) TagConn ¶ added in v0.2.0
TagConn can attach some information to the given context. The returned context will be used for stats handling. For conn stats handling, the context used in HandleConn for this connection will be derived from the context returned. For RPC stats handling,
- On server side, the context used in HandleRPC for all RPCs on this connection will be derived from the context returned.
- On client side, the context is not derived from the context returned.
type NetStats ¶ added in v0.2.0
type NetStats struct {
Setup, Compute, Others ServiceStats
}
type ServiceStats ¶ added in v0.2.0
type ServiceStats struct {
DataSent, DataRecv uint64
}
ServiceStats contains the network statistics of a connection.
func (ServiceStats) String ¶ added in v0.2.0
func (s ServiceStats) String() string
String returns a string representation of the network statistics.
Directories ¶
Path | Synopsis |
---|---|
Package api implements a translation layer between the protobuf and internal Helium types.
|
Package api implements a translation layer between the protobuf and internal Helium types. |
Package circuits provides the types and interfaces for defining, parsing and executing circuits.
|
Package circuits provides the types and interfaces for defining, parsing and executing circuits. |
Package coordinator implements a generic coordinator functionality for helium nodes.
|
Package coordinator implements a generic coordinator functionality for helium nodes. |
examples
|
|
Package node provides the main entry point for the Helium library.
|
Package node provides the main entry point for the Helium library. |
Package objectstore defines an interface between the helium services and the session data.
|
Package objectstore defines an interface between the helium services and the session data. |
Package protocols implements the MHE protocol execution.
|
Package protocols implements the MHE protocol execution. |
Package services provides common utilities for services.
|
Package services provides common utilities for services. |
compute
Package compute implements the MHE compute phase as a service.
|
Package compute implements the MHE compute phase as a service. |
setup
Package setup implements the MHE setup phase as a service.
|
Package setup implements the MHE setup phase as a service. |
Package sessions implements helium sessions.
|
Package sessions implements helium sessions. |
Package utils defines a set of utility functions and types used across the helium project.
|
Package utils defines a set of utility functions and types used across the helium project. |
certs
Package certs provides utility functions for managing certificates.
|
Package certs provides utility functions for managing certificates. |