message_api

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package message_api is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	ReplicationApi_SubscribeEnvelopes_FullMethodName    = "/xmtp.xmtpv4.message_api.ReplicationApi/SubscribeEnvelopes"
	ReplicationApi_QueryEnvelopes_FullMethodName        = "/xmtp.xmtpv4.message_api.ReplicationApi/QueryEnvelopes"
	ReplicationApi_PublishPayerEnvelopes_FullMethodName = "/xmtp.xmtpv4.message_api.ReplicationApi/PublishPayerEnvelopes"
	ReplicationApi_GetInboxIds_FullMethodName           = "/xmtp.xmtpv4.message_api.ReplicationApi/GetInboxIds"
)

Variables

View Source
var (
	Misbehavior_name = map[int32]string{
		0: "MISBEHAVIOR_UNSPECIFIED",
		1: "MISBEHAVIOR_UNAVAILABLE_NODE",
		2: "MISBEHAVIOR_OUT_OF_ORDER_ORIGINATOR_SID",
		3: "MISBEHAVIOR_DUPLICATE_ORIGINATOR_SID",
		4: "MISBEHAVIOR_CYCLICAL_MESSAGE_ORDERING",
	}
	Misbehavior_value = map[string]int32{
		"MISBEHAVIOR_UNSPECIFIED":                 0,
		"MISBEHAVIOR_UNAVAILABLE_NODE":            1,
		"MISBEHAVIOR_OUT_OF_ORDER_ORIGINATOR_SID": 2,
		"MISBEHAVIOR_DUPLICATE_ORIGINATOR_SID":    3,
		"MISBEHAVIOR_CYCLICAL_MESSAGE_ORDERING":   4,
	}
)

Enum value maps for Misbehavior.

View Source
var File_xmtpv4_message_api_message_api_proto protoreflect.FileDescriptor
View Source
var ReplicationApi_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "xmtp.xmtpv4.message_api.ReplicationApi",
	HandlerType: (*ReplicationApiServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "QueryEnvelopes",
			Handler:    _ReplicationApi_QueryEnvelopes_Handler,
		},
		{
			MethodName: "PublishPayerEnvelopes",
			Handler:    _ReplicationApi_PublishPayerEnvelopes_Handler,
		},
		{
			MethodName: "GetInboxIds",
			Handler:    _ReplicationApi_GetInboxIds_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SubscribeEnvelopes",
			Handler:       _ReplicationApi_SubscribeEnvelopes_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "xmtpv4/message_api/message_api.proto",
}

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

Functions

func RegisterReplicationApiHandler

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

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

func RegisterReplicationApiHandlerClient

func RegisterReplicationApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ReplicationApiClient) error

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

func RegisterReplicationApiHandlerFromEndpoint

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

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

func RegisterReplicationApiHandlerServer

func RegisterReplicationApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ReplicationApiServer) error

RegisterReplicationApiHandlerServer registers the http handlers for service ReplicationApi to "mux". UnaryRPC :call ReplicationApiServer 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 RegisterReplicationApiHandlerFromEndpoint instead.

func RegisterReplicationApiServer

func RegisterReplicationApiServer(s grpc.ServiceRegistrar, srv ReplicationApiServer)

Types

type EnvelopesQuery

type EnvelopesQuery struct {

	// Client queries
	Topics [][]byte `protobuf:"bytes,1,rep,name=topics,proto3" json:"topics,omitempty"`
	// Node queries
	OriginatorNodeIds []uint32               `protobuf:"varint,2,rep,packed,name=originator_node_ids,json=originatorNodeIds,proto3" json:"originator_node_ids,omitempty"`
	LastSeen          *envelopes.VectorClock `protobuf:"bytes,3,opt,name=last_seen,json=lastSeen,proto3" json:"last_seen,omitempty"`
	// contains filtered or unexported fields
}

Query for envelopes, shared by query and subscribe endpoints Either topics or originator_node_ids may be set, but not both

func (*EnvelopesQuery) Descriptor deprecated

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

Deprecated: Use EnvelopesQuery.ProtoReflect.Descriptor instead.

func (*EnvelopesQuery) GetLastSeen

func (x *EnvelopesQuery) GetLastSeen() *envelopes.VectorClock

func (*EnvelopesQuery) GetOriginatorNodeIds

func (x *EnvelopesQuery) GetOriginatorNodeIds() []uint32

func (*EnvelopesQuery) GetTopics

func (x *EnvelopesQuery) GetTopics() [][]byte

func (*EnvelopesQuery) ProtoMessage

func (*EnvelopesQuery) ProtoMessage()

func (*EnvelopesQuery) ProtoReflect

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

func (*EnvelopesQuery) Reset

func (x *EnvelopesQuery) Reset()

func (*EnvelopesQuery) String

func (x *EnvelopesQuery) String() string

type GetInboxIdsRequest

type GetInboxIdsRequest struct {
	Requests []*GetInboxIdsRequest_Request `protobuf:"bytes,1,rep,name=requests,proto3" json:"requests,omitempty"`
	// contains filtered or unexported fields
}

Request to retrieve the XIDs for the given addresses

func (*GetInboxIdsRequest) Descriptor deprecated

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

Deprecated: Use GetInboxIdsRequest.ProtoReflect.Descriptor instead.

func (*GetInboxIdsRequest) GetRequests

func (x *GetInboxIdsRequest) GetRequests() []*GetInboxIdsRequest_Request

func (*GetInboxIdsRequest) ProtoMessage

func (*GetInboxIdsRequest) ProtoMessage()

func (*GetInboxIdsRequest) ProtoReflect

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

func (*GetInboxIdsRequest) Reset

func (x *GetInboxIdsRequest) Reset()

func (*GetInboxIdsRequest) String

func (x *GetInboxIdsRequest) String() string

type GetInboxIdsRequest_Request

type GetInboxIdsRequest_Request struct {
	Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// contains filtered or unexported fields
}

A single request for a given address

func (*GetInboxIdsRequest_Request) Descriptor deprecated

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

Deprecated: Use GetInboxIdsRequest_Request.ProtoReflect.Descriptor instead.

func (*GetInboxIdsRequest_Request) GetAddress

func (x *GetInboxIdsRequest_Request) GetAddress() string

func (*GetInboxIdsRequest_Request) ProtoMessage

func (*GetInboxIdsRequest_Request) ProtoMessage()

func (*GetInboxIdsRequest_Request) ProtoReflect

func (*GetInboxIdsRequest_Request) Reset

func (x *GetInboxIdsRequest_Request) Reset()

func (*GetInboxIdsRequest_Request) String

func (x *GetInboxIdsRequest_Request) String() string

type GetInboxIdsResponse

type GetInboxIdsResponse struct {
	Responses []*GetInboxIdsResponse_Response `protobuf:"bytes,1,rep,name=responses,proto3" json:"responses,omitempty"`
	// contains filtered or unexported fields
}

Response with the XIDs for the requested addresses

func (*GetInboxIdsResponse) Descriptor deprecated

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

Deprecated: Use GetInboxIdsResponse.ProtoReflect.Descriptor instead.

func (*GetInboxIdsResponse) GetResponses

func (*GetInboxIdsResponse) ProtoMessage

func (*GetInboxIdsResponse) ProtoMessage()

func (*GetInboxIdsResponse) ProtoReflect

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

func (*GetInboxIdsResponse) Reset

func (x *GetInboxIdsResponse) Reset()

func (*GetInboxIdsResponse) String

func (x *GetInboxIdsResponse) String() string

type GetInboxIdsResponse_Response

type GetInboxIdsResponse_Response struct {
	Address string  `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	InboxId *string `protobuf:"bytes,2,opt,name=inbox_id,json=inboxId,proto3,oneof" json:"inbox_id,omitempty"`
	// contains filtered or unexported fields
}

A single response for a given address

func (*GetInboxIdsResponse_Response) Descriptor deprecated

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

Deprecated: Use GetInboxIdsResponse_Response.ProtoReflect.Descriptor instead.

func (*GetInboxIdsResponse_Response) GetAddress

func (x *GetInboxIdsResponse_Response) GetAddress() string

func (*GetInboxIdsResponse_Response) GetInboxId

func (x *GetInboxIdsResponse_Response) GetInboxId() string

func (*GetInboxIdsResponse_Response) ProtoMessage

func (*GetInboxIdsResponse_Response) ProtoMessage()

func (*GetInboxIdsResponse_Response) ProtoReflect

func (*GetInboxIdsResponse_Response) Reset

func (x *GetInboxIdsResponse_Response) Reset()

func (*GetInboxIdsResponse_Response) String

type Misbehavior

type Misbehavior int32

Misbehavior types

const (
	Misbehavior_MISBEHAVIOR_UNSPECIFIED                 Misbehavior = 0
	Misbehavior_MISBEHAVIOR_UNAVAILABLE_NODE            Misbehavior = 1
	Misbehavior_MISBEHAVIOR_OUT_OF_ORDER_ORIGINATOR_SID Misbehavior = 2
	Misbehavior_MISBEHAVIOR_DUPLICATE_ORIGINATOR_SID    Misbehavior = 3
	Misbehavior_MISBEHAVIOR_CYCLICAL_MESSAGE_ORDERING   Misbehavior = 4
)

func (Misbehavior) Descriptor

func (Misbehavior) Enum

func (x Misbehavior) Enum() *Misbehavior

func (Misbehavior) EnumDescriptor deprecated

func (Misbehavior) EnumDescriptor() ([]byte, []int)

Deprecated: Use Misbehavior.Descriptor instead.

func (Misbehavior) Number

func (x Misbehavior) Number() protoreflect.EnumNumber

func (Misbehavior) String

func (x Misbehavior) String() string

func (Misbehavior) Type

type MisbehaviorReport

type MisbehaviorReport struct {
	Type      Misbehavior                     `protobuf:"varint,1,opt,name=type,proto3,enum=xmtp.xmtpv4.message_api.Misbehavior" json:"type,omitempty"`
	Envelopes []*envelopes.OriginatorEnvelope `protobuf:"bytes,2,rep,name=envelopes,proto3" json:"envelopes,omitempty"`
	// contains filtered or unexported fields
}

Reports node misbehavior, submittable by nodes or by clients

func (*MisbehaviorReport) Descriptor deprecated

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

Deprecated: Use MisbehaviorReport.ProtoReflect.Descriptor instead.

func (*MisbehaviorReport) GetEnvelopes

func (x *MisbehaviorReport) GetEnvelopes() []*envelopes.OriginatorEnvelope

func (*MisbehaviorReport) GetType

func (x *MisbehaviorReport) GetType() Misbehavior

func (*MisbehaviorReport) ProtoMessage

func (*MisbehaviorReport) ProtoMessage()

func (*MisbehaviorReport) ProtoReflect

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

func (*MisbehaviorReport) Reset

func (x *MisbehaviorReport) Reset()

func (*MisbehaviorReport) String

func (x *MisbehaviorReport) String() string

type PublishPayerEnvelopesRequest

type PublishPayerEnvelopesRequest struct {
	PayerEnvelopes []*envelopes.PayerEnvelope `protobuf:"bytes,1,rep,name=payer_envelopes,json=payerEnvelopes,proto3" json:"payer_envelopes,omitempty"`
	// contains filtered or unexported fields
}

func (*PublishPayerEnvelopesRequest) Descriptor deprecated

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

Deprecated: Use PublishPayerEnvelopesRequest.ProtoReflect.Descriptor instead.

func (*PublishPayerEnvelopesRequest) GetPayerEnvelopes

func (x *PublishPayerEnvelopesRequest) GetPayerEnvelopes() []*envelopes.PayerEnvelope

func (*PublishPayerEnvelopesRequest) ProtoMessage

func (*PublishPayerEnvelopesRequest) ProtoMessage()

func (*PublishPayerEnvelopesRequest) ProtoReflect

func (*PublishPayerEnvelopesRequest) Reset

func (x *PublishPayerEnvelopesRequest) Reset()

func (*PublishPayerEnvelopesRequest) String

type PublishPayerEnvelopesResponse

type PublishPayerEnvelopesResponse struct {
	OriginatorEnvelopes []*envelopes.OriginatorEnvelope `protobuf:"bytes,1,rep,name=originator_envelopes,json=originatorEnvelopes,proto3" json:"originator_envelopes,omitempty"`
	// contains filtered or unexported fields
}

func (*PublishPayerEnvelopesResponse) Descriptor deprecated

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

Deprecated: Use PublishPayerEnvelopesResponse.ProtoReflect.Descriptor instead.

func (*PublishPayerEnvelopesResponse) GetOriginatorEnvelopes

func (x *PublishPayerEnvelopesResponse) GetOriginatorEnvelopes() []*envelopes.OriginatorEnvelope

func (*PublishPayerEnvelopesResponse) ProtoMessage

func (*PublishPayerEnvelopesResponse) ProtoMessage()

func (*PublishPayerEnvelopesResponse) ProtoReflect

func (*PublishPayerEnvelopesResponse) Reset

func (x *PublishPayerEnvelopesResponse) Reset()

func (*PublishPayerEnvelopesResponse) String

type QueryEnvelopesRequest

type QueryEnvelopesRequest struct {
	Query *EnvelopesQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	Limit uint32          `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

Query envelopes request

func (*QueryEnvelopesRequest) Descriptor deprecated

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

Deprecated: Use QueryEnvelopesRequest.ProtoReflect.Descriptor instead.

func (*QueryEnvelopesRequest) GetLimit

func (x *QueryEnvelopesRequest) GetLimit() uint32

func (*QueryEnvelopesRequest) GetQuery

func (x *QueryEnvelopesRequest) GetQuery() *EnvelopesQuery

func (*QueryEnvelopesRequest) ProtoMessage

func (*QueryEnvelopesRequest) ProtoMessage()

func (*QueryEnvelopesRequest) ProtoReflect

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

func (*QueryEnvelopesRequest) Reset

func (x *QueryEnvelopesRequest) Reset()

func (*QueryEnvelopesRequest) String

func (x *QueryEnvelopesRequest) String() string

type QueryEnvelopesResponse

type QueryEnvelopesResponse struct {
	Envelopes []*envelopes.OriginatorEnvelope `protobuf:"bytes,1,rep,name=envelopes,proto3" json:"envelopes,omitempty"`
	// contains filtered or unexported fields
}

Query envelopes response

func (*QueryEnvelopesResponse) Descriptor deprecated

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

Deprecated: Use QueryEnvelopesResponse.ProtoReflect.Descriptor instead.

func (*QueryEnvelopesResponse) GetEnvelopes

func (*QueryEnvelopesResponse) ProtoMessage

func (*QueryEnvelopesResponse) ProtoMessage()

func (*QueryEnvelopesResponse) ProtoReflect

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

func (*QueryEnvelopesResponse) Reset

func (x *QueryEnvelopesResponse) Reset()

func (*QueryEnvelopesResponse) String

func (x *QueryEnvelopesResponse) String() string

type ReplicationApiClient

type ReplicationApiClient interface {
	// Subscribe to envelopes
	SubscribeEnvelopes(ctx context.Context, in *SubscribeEnvelopesRequest, opts ...grpc.CallOption) (ReplicationApi_SubscribeEnvelopesClient, error)
	// Query envelopes
	QueryEnvelopes(ctx context.Context, in *QueryEnvelopesRequest, opts ...grpc.CallOption) (*QueryEnvelopesResponse, error)
	// Publish envelope
	PublishPayerEnvelopes(ctx context.Context, in *PublishPayerEnvelopesRequest, opts ...grpc.CallOption) (*PublishPayerEnvelopesResponse, error)
	// Get inbox ids
	GetInboxIds(ctx context.Context, in *GetInboxIdsRequest, opts ...grpc.CallOption) (*GetInboxIdsResponse, error)
}

ReplicationApiClient is the client API for ReplicationApi 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.

type ReplicationApiServer

type ReplicationApiServer interface {
	// Subscribe to envelopes
	SubscribeEnvelopes(*SubscribeEnvelopesRequest, ReplicationApi_SubscribeEnvelopesServer) error
	// Query envelopes
	QueryEnvelopes(context.Context, *QueryEnvelopesRequest) (*QueryEnvelopesResponse, error)
	// Publish envelope
	PublishPayerEnvelopes(context.Context, *PublishPayerEnvelopesRequest) (*PublishPayerEnvelopesResponse, error)
	// Get inbox ids
	GetInboxIds(context.Context, *GetInboxIdsRequest) (*GetInboxIdsResponse, error)
	// contains filtered or unexported methods
}

ReplicationApiServer is the server API for ReplicationApi service. All implementations must embed UnimplementedReplicationApiServer for forward compatibility

type ReplicationApi_SubscribeEnvelopesClient

type ReplicationApi_SubscribeEnvelopesClient interface {
	Recv() (*SubscribeEnvelopesResponse, error)
	grpc.ClientStream
}

type ReplicationApi_SubscribeEnvelopesServer

type ReplicationApi_SubscribeEnvelopesServer interface {
	Send(*SubscribeEnvelopesResponse) error
	grpc.ServerStream
}

type SubscribeEnvelopesRequest

type SubscribeEnvelopesRequest struct {
	Query *EnvelopesQuery `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	// contains filtered or unexported fields
}

Batch subscribe to envelopes

func (*SubscribeEnvelopesRequest) Descriptor deprecated

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

Deprecated: Use SubscribeEnvelopesRequest.ProtoReflect.Descriptor instead.

func (*SubscribeEnvelopesRequest) GetQuery

func (*SubscribeEnvelopesRequest) ProtoMessage

func (*SubscribeEnvelopesRequest) ProtoMessage()

func (*SubscribeEnvelopesRequest) ProtoReflect

func (*SubscribeEnvelopesRequest) Reset

func (x *SubscribeEnvelopesRequest) Reset()

func (*SubscribeEnvelopesRequest) String

func (x *SubscribeEnvelopesRequest) String() string

type SubscribeEnvelopesResponse

type SubscribeEnvelopesResponse struct {
	Envelopes []*envelopes.OriginatorEnvelope `protobuf:"bytes,1,rep,name=envelopes,proto3" json:"envelopes,omitempty"`
	// contains filtered or unexported fields
}

Streamed response for batch subscribe - can be multiple envelopes at once

func (*SubscribeEnvelopesResponse) Descriptor deprecated

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

Deprecated: Use SubscribeEnvelopesResponse.ProtoReflect.Descriptor instead.

func (*SubscribeEnvelopesResponse) GetEnvelopes

func (*SubscribeEnvelopesResponse) ProtoMessage

func (*SubscribeEnvelopesResponse) ProtoMessage()

func (*SubscribeEnvelopesResponse) ProtoReflect

func (*SubscribeEnvelopesResponse) Reset

func (x *SubscribeEnvelopesResponse) Reset()

func (*SubscribeEnvelopesResponse) String

func (x *SubscribeEnvelopesResponse) String() string

type UnimplementedReplicationApiServer

type UnimplementedReplicationApiServer struct {
}

UnimplementedReplicationApiServer must be embedded to have forward compatible implementations.

func (UnimplementedReplicationApiServer) GetInboxIds

func (UnimplementedReplicationApiServer) QueryEnvelopes

type UnsafeReplicationApiServer

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

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

Jump to

Keyboard shortcuts

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