models

package
v0.0.0-...-c435033 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Chord_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "models.Chord",
	HandlerType: (*ChordServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetPredecessor",
			Handler:    _Chord_GetPredecessor_Handler,
		},
		{
			MethodName: "GetSuccessor",
			Handler:    _Chord_GetSuccessor_Handler,
		},
		{
			MethodName: "Notify",
			Handler:    _Chord_Notify_Handler,
		},
		{
			MethodName: "FindSuccessor",
			Handler:    _Chord_FindSuccessor_Handler,
		},
		{
			MethodName: "CheckPredecessor",
			Handler:    _Chord_CheckPredecessor_Handler,
		},
		{
			MethodName: "SetPredecessor",
			Handler:    _Chord_SetPredecessor_Handler,
		},
		{
			MethodName: "SetSuccessor",
			Handler:    _Chord_SetSuccessor_Handler,
		},
		{
			MethodName: "XGet",
			Handler:    _Chord_XGet_Handler,
		},
		{
			MethodName: "XSet",
			Handler:    _Chord_XSet_Handler,
		},
		{
			MethodName: "XAdd",
			Handler:    _Chord_XAdd_Handler,
		},
		{
			MethodName: "XDelete",
			Handler:    _Chord_XDelete_Handler,
		},
		{
			MethodName: "XMultiDelete",
			Handler:    _Chord_XMultiDelete_Handler,
		},
		{
			MethodName: "XRequestKeys",
			Handler:    _Chord_XRequestKeys_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "models/chord.proto",
}

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

View Source
var File_models_chord_proto protoreflect.FileDescriptor

Functions

func RegisterChordServer

func RegisterChordServer(s grpc.ServiceRegistrar, srv ChordServer)

Types

type AddRequest

type AddRequest struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value int64  `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*AddRequest) Descriptor deprecated

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

Deprecated: Use AddRequest.ProtoReflect.Descriptor instead.

func (*AddRequest) GetKey

func (x *AddRequest) GetKey() string

func (*AddRequest) GetValue

func (x *AddRequest) GetValue() int64

func (*AddRequest) ProtoMessage

func (*AddRequest) ProtoMessage()

func (*AddRequest) ProtoReflect

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

func (*AddRequest) Reset

func (x *AddRequest) Reset()

func (*AddRequest) String

func (x *AddRequest) String() string

type ChordClient

type ChordClient interface {
	// GetPredecessor returns the node believed to be the current predecessor.
	GetPredecessor(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Node, error)
	// GetSuccessor returns the node believed to be the current successor.
	GetSuccessor(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*Node, error)
	// Notify notifies Chord that Node thinks it is our predecessor. This has
	// the potential to initiate the transferring of keys.
	Notify(ctx context.Context, in *Node, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// FindSuccessor finds the node the succeeds ID. May initiate RPC calls to
	// other nodes.
	FindSuccessor(ctx context.Context, in *ID, opts ...grpc.CallOption) (*Node, error)
	// CheckPredecessor checks whether predecessor has failed.
	CheckPredecessor(ctx context.Context, in *ID, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// SetPredecessor sets predecessor for a node.
	SetPredecessor(ctx context.Context, in *Node, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// SetPredecessor sets predecessor for a node.
	SetSuccessor(ctx context.Context, in *Node, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Get returns the value in Chord ring for the given key.
	XGet(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*GetResponse, error)
	// Set writes a key value pair to the Chord ring.
	XSet(ctx context.Context, in *SetRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Add increments the value for a key in the Chord ring.
	XAdd(ctx context.Context, in *AddRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Delete returns the value in Chord ring for the given key.
	XDelete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	// Multiple delete returns the value in Chord ring between the given keys.
	XMultiDelete(ctx context.Context, in *MultiDeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	// RequestKeys returns the keys between given range from the Chord ring.
	XRequestKeys(ctx context.Context, in *RequestKeysRequest, opts ...grpc.CallOption) (*RequestKeysResponse, error)
}

ChordClient is the client API for Chord 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 NewChordClient

func NewChordClient(cc grpc.ClientConnInterface) ChordClient

type ChordServer

type ChordServer interface {
	// GetPredecessor returns the node believed to be the current predecessor.
	GetPredecessor(context.Context, *emptypb.Empty) (*Node, error)
	// GetSuccessor returns the node believed to be the current successor.
	GetSuccessor(context.Context, *emptypb.Empty) (*Node, error)
	// Notify notifies Chord that Node thinks it is our predecessor. This has
	// the potential to initiate the transferring of keys.
	Notify(context.Context, *Node) (*emptypb.Empty, error)
	// FindSuccessor finds the node the succeeds ID. May initiate RPC calls to
	// other nodes.
	FindSuccessor(context.Context, *ID) (*Node, error)
	// CheckPredecessor checks whether predecessor has failed.
	CheckPredecessor(context.Context, *ID) (*emptypb.Empty, error)
	// SetPredecessor sets predecessor for a node.
	SetPredecessor(context.Context, *Node) (*emptypb.Empty, error)
	// SetPredecessor sets predecessor for a node.
	SetSuccessor(context.Context, *Node) (*emptypb.Empty, error)
	// Get returns the value in Chord ring for the given key.
	XGet(context.Context, *GetRequest) (*GetResponse, error)
	// Set writes a key value pair to the Chord ring.
	XSet(context.Context, *SetRequest) (*emptypb.Empty, error)
	// Add increments the value for a key in the Chord ring.
	XAdd(context.Context, *AddRequest) (*emptypb.Empty, error)
	// Delete returns the value in Chord ring for the given key.
	XDelete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	// Multiple delete returns the value in Chord ring between the given keys.
	XMultiDelete(context.Context, *MultiDeleteRequest) (*DeleteResponse, error)
	// RequestKeys returns the keys between given range from the Chord ring.
	XRequestKeys(context.Context, *RequestKeysRequest) (*RequestKeysResponse, error)
}

ChordServer is the server API for Chord service. All implementations should embed UnimplementedChordServer for forward compatibility

type DeleteRequest

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

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetKey

func (x *DeleteRequest) GetKey() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

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

func (*DeleteResponse) Descriptor deprecated

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

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

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type GetRequest

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

func (*GetRequest) Descriptor deprecated

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

Deprecated: Use GetRequest.ProtoReflect.Descriptor instead.

func (*GetRequest) GetKey

func (x *GetRequest) GetKey() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) ProtoReflect

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

func (*GetRequest) Reset

func (x *GetRequest) Reset()

func (*GetRequest) String

func (x *GetRequest) String() string

type GetResponse

type GetResponse struct {
	Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*GetResponse) Descriptor deprecated

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

Deprecated: Use GetResponse.ProtoReflect.Descriptor instead.

func (*GetResponse) GetValue

func (x *GetResponse) GetValue() []byte

func (*GetResponse) ProtoMessage

func (*GetResponse) ProtoMessage()

func (*GetResponse) ProtoReflect

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

func (*GetResponse) Reset

func (x *GetResponse) Reset()

func (*GetResponse) String

func (x *GetResponse) String() string

type ID

type ID struct {
	Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*ID) Descriptor deprecated

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

Deprecated: Use ID.ProtoReflect.Descriptor instead.

func (*ID) GetId

func (x *ID) GetId() []byte

func (*ID) ProtoMessage

func (*ID) ProtoMessage()

func (*ID) ProtoReflect

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

func (*ID) Reset

func (x *ID) Reset()

func (*ID) String

func (x *ID) String() string

type KV

type KV struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*KV) Descriptor deprecated

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

Deprecated: Use KV.ProtoReflect.Descriptor instead.

func (*KV) GetKey

func (x *KV) GetKey() string

func (*KV) GetValue

func (x *KV) GetValue() []byte

func (*KV) ProtoMessage

func (*KV) ProtoMessage()

func (*KV) ProtoReflect

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

func (*KV) Reset

func (x *KV) Reset()

func (*KV) String

func (x *KV) String() string

type MultiDeleteRequest

type MultiDeleteRequest struct {
	Keys []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
	// contains filtered or unexported fields
}

func (*MultiDeleteRequest) Descriptor deprecated

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

Deprecated: Use MultiDeleteRequest.ProtoReflect.Descriptor instead.

func (*MultiDeleteRequest) GetKeys

func (x *MultiDeleteRequest) GetKeys() []string

func (*MultiDeleteRequest) ProtoMessage

func (*MultiDeleteRequest) ProtoMessage()

func (*MultiDeleteRequest) ProtoReflect

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

func (*MultiDeleteRequest) Reset

func (x *MultiDeleteRequest) Reset()

func (*MultiDeleteRequest) String

func (x *MultiDeleteRequest) String() string

type Node

type Node struct {
	Id   []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Addr string `protobuf:"bytes,2,opt,name=addr,proto3" json:"addr,omitempty"`
	// contains filtered or unexported fields
}

Node contains a node ID and address.

func (*Node) Descriptor deprecated

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

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetAddr

func (x *Node) GetAddr() string

func (*Node) GetId

func (x *Node) GetId() []byte

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

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

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

type RequestKeysRequest

type RequestKeysRequest struct {
	From []byte `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	To   []byte `protobuf:"bytes,2,opt,name=to,proto3" json:"to,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestKeysRequest) Descriptor deprecated

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

Deprecated: Use RequestKeysRequest.ProtoReflect.Descriptor instead.

func (*RequestKeysRequest) GetFrom

func (x *RequestKeysRequest) GetFrom() []byte

func (*RequestKeysRequest) GetTo

func (x *RequestKeysRequest) GetTo() []byte

func (*RequestKeysRequest) ProtoMessage

func (*RequestKeysRequest) ProtoMessage()

func (*RequestKeysRequest) ProtoReflect

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

func (*RequestKeysRequest) Reset

func (x *RequestKeysRequest) Reset()

func (*RequestKeysRequest) String

func (x *RequestKeysRequest) String() string

type RequestKeysResponse

type RequestKeysResponse struct {
	Values []*KV `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestKeysResponse) Descriptor deprecated

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

Deprecated: Use RequestKeysResponse.ProtoReflect.Descriptor instead.

func (*RequestKeysResponse) GetValues

func (x *RequestKeysResponse) GetValues() []*KV

func (*RequestKeysResponse) ProtoMessage

func (*RequestKeysResponse) ProtoMessage()

func (*RequestKeysResponse) ProtoReflect

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

func (*RequestKeysResponse) Reset

func (x *RequestKeysResponse) Reset()

func (*RequestKeysResponse) String

func (x *RequestKeysResponse) String() string

type SetRequest

type SetRequest struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*SetRequest) Descriptor deprecated

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

Deprecated: Use SetRequest.ProtoReflect.Descriptor instead.

func (*SetRequest) GetKey

func (x *SetRequest) GetKey() string

func (*SetRequest) GetValue

func (x *SetRequest) GetValue() []byte

func (*SetRequest) ProtoMessage

func (*SetRequest) ProtoMessage()

func (*SetRequest) ProtoReflect

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

func (*SetRequest) Reset

func (x *SetRequest) Reset()

func (*SetRequest) String

func (x *SetRequest) String() string

type UnimplementedChordServer

type UnimplementedChordServer struct {
}

UnimplementedChordServer should be embedded to have forward compatible implementations.

func (UnimplementedChordServer) CheckPredecessor

func (UnimplementedChordServer) CheckPredecessor(context.Context, *ID) (*emptypb.Empty, error)

func (UnimplementedChordServer) FindSuccessor

func (UnimplementedChordServer) FindSuccessor(context.Context, *ID) (*Node, error)

func (UnimplementedChordServer) GetPredecessor

func (UnimplementedChordServer) GetSuccessor

func (UnimplementedChordServer) Notify

func (UnimplementedChordServer) SetPredecessor

func (UnimplementedChordServer) SetSuccessor

func (UnimplementedChordServer) XAdd

func (UnimplementedChordServer) XDelete

func (UnimplementedChordServer) XGet

func (UnimplementedChordServer) XMultiDelete

func (UnimplementedChordServer) XRequestKeys

func (UnimplementedChordServer) XSet

type UnsafeChordServer

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

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

Jump to

Keyboard shortcuts

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