api

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_rpc_api_api_proto protoreflect.FileDescriptor
View Source
var Poet_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "api.Poet",
	HandlerType: (*PoetServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Start",
			Handler:    _Poet_Start_Handler,
		},
		{
			MethodName: "UpdateGateway",
			Handler:    _Poet_UpdateGateway_Handler,
		},
		{
			MethodName: "Submit",
			Handler:    _Poet_Submit_Handler,
		},
		{
			MethodName: "GetInfo",
			Handler:    _Poet_GetInfo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "rpc/api/api.proto",
}

Poet_ServiceDesc is the grpc.ServiceDesc for Poet service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterPoetHandler

func RegisterPoetHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterPoetHandler registers the http handlers for service Poet to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterPoetHandlerClient

func RegisterPoetHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PoetClient) error

RegisterPoetHandlerClient registers the http handlers for service Poet to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "PoetClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "PoetClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "PoetClient" to call the correct interceptors.

func RegisterPoetHandlerFromEndpoint

func RegisterPoetHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterPoetHandlerFromEndpoint is same as RegisterPoetHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterPoetHandlerServer

func RegisterPoetHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PoetServer) error

RegisterPoetHandlerServer registers the http handlers for service Poet to "mux". UnaryRPC :call PoetServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterPoetHandlerFromEndpoint instead.

func RegisterPoetServer

func RegisterPoetServer(s grpc.ServiceRegistrar, srv PoetServer)

Types

type GetInfoRequest

type GetInfoRequest struct {
	// contains filtered or unexported fields
}

func (*GetInfoRequest) Descriptor deprecated

func (*GetInfoRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetInfoRequest.ProtoReflect.Descriptor instead.

func (*GetInfoRequest) ProtoMessage

func (*GetInfoRequest) ProtoMessage()

func (*GetInfoRequest) ProtoReflect

func (x *GetInfoRequest) ProtoReflect() protoreflect.Message

func (*GetInfoRequest) Reset

func (x *GetInfoRequest) Reset()

func (*GetInfoRequest) String

func (x *GetInfoRequest) String() string

type GetInfoResponse

type GetInfoResponse struct {
	OpenRoundId        string   `protobuf:"bytes,1,opt,name=openRoundId,proto3" json:"openRoundId,omitempty"`
	ExecutingRoundsIds []string `protobuf:"bytes,2,rep,name=executingRoundsIds,proto3" json:"executingRoundsIds,omitempty"`
	ServicePubKey      []byte   `protobuf:"bytes,3,opt,name=servicePubKey,proto3" json:"servicePubKey,omitempty"`
	// contains filtered or unexported fields
}

func (*GetInfoResponse) Descriptor deprecated

func (*GetInfoResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetInfoResponse.ProtoReflect.Descriptor instead.

func (*GetInfoResponse) GetExecutingRoundsIds

func (x *GetInfoResponse) GetExecutingRoundsIds() []string

func (*GetInfoResponse) GetOpenRoundId

func (x *GetInfoResponse) GetOpenRoundId() string

func (*GetInfoResponse) GetServicePubKey

func (x *GetInfoResponse) GetServicePubKey() []byte

func (*GetInfoResponse) ProtoMessage

func (*GetInfoResponse) ProtoMessage()

func (*GetInfoResponse) ProtoReflect

func (x *GetInfoResponse) ProtoReflect() protoreflect.Message

func (*GetInfoResponse) Reset

func (x *GetInfoResponse) Reset()

func (*GetInfoResponse) String

func (x *GetInfoResponse) String() string

type MembershipProof

type MembershipProof struct {
	Index int32    `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
	Root  []byte   `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"`
	Proof [][]byte `protobuf:"bytes,3,rep,name=proof,proto3" json:"proof,omitempty"`
	// contains filtered or unexported fields
}

func (*MembershipProof) Descriptor deprecated

func (*MembershipProof) Descriptor() ([]byte, []int)

Deprecated: Use MembershipProof.ProtoReflect.Descriptor instead.

func (*MembershipProof) GetIndex

func (x *MembershipProof) GetIndex() int32

func (*MembershipProof) GetProof

func (x *MembershipProof) GetProof() [][]byte

func (*MembershipProof) GetRoot

func (x *MembershipProof) GetRoot() []byte

func (*MembershipProof) ProtoMessage

func (*MembershipProof) ProtoMessage()

func (*MembershipProof) ProtoReflect

func (x *MembershipProof) ProtoReflect() protoreflect.Message

func (*MembershipProof) Reset

func (x *MembershipProof) Reset()

func (*MembershipProof) String

func (x *MembershipProof) String() string

type PoetClient

type PoetClient interface {
	// Start is used to start the service.
	Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*StartResponse, error)
	// UpdateGateway allows to update the list of gateway addresses (with additional broadcasting config),
	// similar to the Start rpc, but after the service already started.
	UpdateGateway(ctx context.Context, in *UpdateGatewayRequest, opts ...grpc.CallOption) (*UpdateGatewayResponse, error)
	// Submit adds a challenge to the service's current open round,
	// to be included its later generated proof.
	Submit(ctx context.Context, in *SubmitRequest, opts ...grpc.CallOption) (*SubmitResponse, error)
	// GetInfo returns general information concerning the service,
	// including its identity pubkey.
	GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error)
}

PoetClient is the client API for Poet service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewPoetClient

func NewPoetClient(cc grpc.ClientConnInterface) PoetClient

type PoetProof

type PoetProof struct {
	Phi          []byte   `protobuf:"bytes,1,opt,name=phi,proto3" json:"phi,omitempty"`
	ProvenLeaves [][]byte `protobuf:"bytes,2,rep,name=provenLeaves,proto3" json:"provenLeaves,omitempty"`
	ProofNodes   [][]byte `protobuf:"bytes,3,rep,name=proofNodes,proto3" json:"proofNodes,omitempty"`
	// contains filtered or unexported fields
}

func (*PoetProof) Descriptor deprecated

func (*PoetProof) Descriptor() ([]byte, []int)

Deprecated: Use PoetProof.ProtoReflect.Descriptor instead.

func (*PoetProof) GetPhi

func (x *PoetProof) GetPhi() []byte

func (*PoetProof) GetProofNodes

func (x *PoetProof) GetProofNodes() [][]byte

func (*PoetProof) GetProvenLeaves

func (x *PoetProof) GetProvenLeaves() [][]byte

func (*PoetProof) ProtoMessage

func (*PoetProof) ProtoMessage()

func (*PoetProof) ProtoReflect

func (x *PoetProof) ProtoReflect() protoreflect.Message

func (*PoetProof) Reset

func (x *PoetProof) Reset()

func (*PoetProof) String

func (x *PoetProof) String() string

type PoetServer

type PoetServer interface {
	// Start is used to start the service.
	Start(context.Context, *StartRequest) (*StartResponse, error)
	// UpdateGateway allows to update the list of gateway addresses (with additional broadcasting config),
	// similar to the Start rpc, but after the service already started.
	UpdateGateway(context.Context, *UpdateGatewayRequest) (*UpdateGatewayResponse, error)
	// Submit adds a challenge to the service's current open round,
	// to be included its later generated proof.
	Submit(context.Context, *SubmitRequest) (*SubmitResponse, error)
	// GetInfo returns general information concerning the service,
	// including its identity pubkey.
	GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error)
}

PoetServer is the server API for Poet service. All implementations should embed UnimplementedPoetServer for forward compatibility

type StartRequest

type StartRequest struct {
	GatewayAddresses       []string `protobuf:"bytes,1,rep,name=gatewayAddresses,proto3" json:"gatewayAddresses,omitempty"`
	DisableBroadcast       bool     `protobuf:"varint,2,opt,name=disableBroadcast,proto3" json:"disableBroadcast,omitempty"`
	ConnAcksThreshold      int32    `protobuf:"varint,3,opt,name=connAcksThreshold,proto3" json:"connAcksThreshold,omitempty"`
	BroadcastAcksThreshold int32    `protobuf:"varint,4,opt,name=broadcastAcksThreshold,proto3" json:"broadcastAcksThreshold,omitempty"`
	// contains filtered or unexported fields
}

func (*StartRequest) Descriptor deprecated

func (*StartRequest) Descriptor() ([]byte, []int)

Deprecated: Use StartRequest.ProtoReflect.Descriptor instead.

func (*StartRequest) GetBroadcastAcksThreshold

func (x *StartRequest) GetBroadcastAcksThreshold() int32

func (*StartRequest) GetConnAcksThreshold

func (x *StartRequest) GetConnAcksThreshold() int32

func (*StartRequest) GetDisableBroadcast

func (x *StartRequest) GetDisableBroadcast() bool

func (*StartRequest) GetGatewayAddresses

func (x *StartRequest) GetGatewayAddresses() []string

func (*StartRequest) ProtoMessage

func (*StartRequest) ProtoMessage()

func (*StartRequest) ProtoReflect

func (x *StartRequest) ProtoReflect() protoreflect.Message

func (*StartRequest) Reset

func (x *StartRequest) Reset()

func (*StartRequest) String

func (x *StartRequest) String() string

type StartResponse

type StartResponse struct {
	// contains filtered or unexported fields
}

func (*StartResponse) Descriptor deprecated

func (*StartResponse) Descriptor() ([]byte, []int)

Deprecated: Use StartResponse.ProtoReflect.Descriptor instead.

func (*StartResponse) ProtoMessage

func (*StartResponse) ProtoMessage()

func (*StartResponse) ProtoReflect

func (x *StartResponse) ProtoReflect() protoreflect.Message

func (*StartResponse) Reset

func (x *StartResponse) Reset()

func (*StartResponse) String

func (x *StartResponse) String() string

type SubmitRequest

type SubmitRequest struct {
	Challenge []byte `protobuf:"bytes,1,opt,name=challenge,proto3" json:"challenge,omitempty"`
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

func (*SubmitRequest) Descriptor deprecated

func (*SubmitRequest) Descriptor() ([]byte, []int)

Deprecated: Use SubmitRequest.ProtoReflect.Descriptor instead.

func (*SubmitRequest) GetChallenge

func (x *SubmitRequest) GetChallenge() []byte

func (*SubmitRequest) GetSignature added in v0.2.2

func (x *SubmitRequest) GetSignature() []byte

func (*SubmitRequest) ProtoMessage

func (*SubmitRequest) ProtoMessage()

func (*SubmitRequest) ProtoReflect

func (x *SubmitRequest) ProtoReflect() protoreflect.Message

func (*SubmitRequest) Reset

func (x *SubmitRequest) Reset()

func (*SubmitRequest) String

func (x *SubmitRequest) String() string

type SubmitResponse

type SubmitResponse struct {
	RoundId string `protobuf:"bytes,1,opt,name=roundId,proto3" json:"roundId,omitempty"`
	Hash    []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

func (*SubmitResponse) Descriptor deprecated

func (*SubmitResponse) Descriptor() ([]byte, []int)

Deprecated: Use SubmitResponse.ProtoReflect.Descriptor instead.

func (*SubmitResponse) GetHash added in v0.2.2

func (x *SubmitResponse) GetHash() []byte

func (*SubmitResponse) GetRoundId

func (x *SubmitResponse) GetRoundId() string

func (*SubmitResponse) ProtoMessage

func (*SubmitResponse) ProtoMessage()

func (*SubmitResponse) ProtoReflect

func (x *SubmitResponse) ProtoReflect() protoreflect.Message

func (*SubmitResponse) Reset

func (x *SubmitResponse) Reset()

func (*SubmitResponse) String

func (x *SubmitResponse) String() string

type UnimplementedPoetServer

type UnimplementedPoetServer struct {
}

UnimplementedPoetServer should be embedded to have forward compatible implementations.

func (UnimplementedPoetServer) GetInfo

func (UnimplementedPoetServer) Start

func (UnimplementedPoetServer) Submit

func (UnimplementedPoetServer) UpdateGateway

type UnsafePoetServer

type UnsafePoetServer interface {
	// contains filtered or unexported methods
}

UnsafePoetServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PoetServer will result in compilation errors.

type UpdateGatewayRequest

type UpdateGatewayRequest struct {
	GatewayAddresses       []string `protobuf:"bytes,1,rep,name=gatewayAddresses,proto3" json:"gatewayAddresses,omitempty"`
	DisableBroadcast       bool     `protobuf:"varint,2,opt,name=disableBroadcast,proto3" json:"disableBroadcast,omitempty"`
	ConnAcksThreshold      int32    `protobuf:"varint,3,opt,name=connAcksThreshold,proto3" json:"connAcksThreshold,omitempty"`
	BroadcastAcksThreshold int32    `protobuf:"varint,4,opt,name=broadcastAcksThreshold,proto3" json:"broadcastAcksThreshold,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateGatewayRequest) Descriptor deprecated

func (*UpdateGatewayRequest) Descriptor() ([]byte, []int)

Deprecated: Use UpdateGatewayRequest.ProtoReflect.Descriptor instead.

func (*UpdateGatewayRequest) GetBroadcastAcksThreshold

func (x *UpdateGatewayRequest) GetBroadcastAcksThreshold() int32

func (*UpdateGatewayRequest) GetConnAcksThreshold

func (x *UpdateGatewayRequest) GetConnAcksThreshold() int32

func (*UpdateGatewayRequest) GetDisableBroadcast

func (x *UpdateGatewayRequest) GetDisableBroadcast() bool

func (*UpdateGatewayRequest) GetGatewayAddresses

func (x *UpdateGatewayRequest) GetGatewayAddresses() []string

func (*UpdateGatewayRequest) ProtoMessage

func (*UpdateGatewayRequest) ProtoMessage()

func (*UpdateGatewayRequest) ProtoReflect

func (x *UpdateGatewayRequest) ProtoReflect() protoreflect.Message

func (*UpdateGatewayRequest) Reset

func (x *UpdateGatewayRequest) Reset()

func (*UpdateGatewayRequest) String

func (x *UpdateGatewayRequest) String() string

type UpdateGatewayResponse

type UpdateGatewayResponse struct {
	// contains filtered or unexported fields
}

func (*UpdateGatewayResponse) Descriptor deprecated

func (*UpdateGatewayResponse) Descriptor() ([]byte, []int)

Deprecated: Use UpdateGatewayResponse.ProtoReflect.Descriptor instead.

func (*UpdateGatewayResponse) ProtoMessage

func (*UpdateGatewayResponse) ProtoMessage()

func (*UpdateGatewayResponse) ProtoReflect

func (x *UpdateGatewayResponse) ProtoReflect() protoreflect.Message

func (*UpdateGatewayResponse) Reset

func (x *UpdateGatewayResponse) Reset()

func (*UpdateGatewayResponse) String

func (x *UpdateGatewayResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL