Documentation
¶
Index ¶
- Constants
- Variables
- type AppendCommand
- type AppendCommandResult
- func (*AppendCommandResult) Descriptor() ([]byte, []int)deprecated
- func (x *AppendCommandResult) GetId() int32
- func (*AppendCommandResult) ProtoMessage()
- func (x *AppendCommandResult) ProtoReflect() protoreflect.Message
- func (x *AppendCommandResult) Reset()
- func (x *AppendCommandResult) String() string
- type Config
- type DeleteCommand
- func (*DeleteCommand) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteCommand) GetFileId() int32
- func (x *DeleteCommand) GetId() int32
- func (x *DeleteCommand) GetUserId() int32
- func (*DeleteCommand) ProtoMessage()
- func (x *DeleteCommand) ProtoReflect() protoreflect.Message
- func (x *DeleteCommand) Reset()
- func (x *DeleteCommand) String() string
- type DeleteCommandResult
- type DistributedMessages
- func (m *DistributedMessages) DeleteMessage(ctx context.Context, log *logger.Logger, params *model.DeleteMessageParams) error
- func (m *DistributedMessages) GetServers(_ context.Context, log *logger.Logger) ([](*api.Server), error)
- func (m *DistributedMessages) Join(id, addr string) error
- func (m *DistributedMessages) Leave(id string) error
- func (m *DistributedMessages) ReadUserMessages(ctx context.Context, log *logger.Logger, params *model.ReadUserMessagesParams) (*model.ReadUserMessagesResult, error)
- func (m *DistributedMessages) SaveMessage(ctx context.Context, log *logger.Logger, params *model.SaveMessageParams) error
- func (m *DistributedMessages) UpdateMessage(ctx context.Context, log *logger.Logger, params *model.UpdateMessageParams) error
- func (m *DistributedMessages) WaitForLeader(timeout time.Duration) error
- type Repository
- type RequestType
- type StreamLayer
- type UpdateCommand
- func (*UpdateCommand) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateCommand) GetFileId() int32
- func (x *UpdateCommand) GetId() int32
- func (x *UpdateCommand) GetText() string
- func (x *UpdateCommand) GetUpdateUtcNano() int64
- func (x *UpdateCommand) GetUserId() int32
- func (*UpdateCommand) ProtoMessage()
- func (x *UpdateCommand) ProtoReflect() protoreflect.Message
- func (x *UpdateCommand) Reset()
- func (x *UpdateCommand) String() string
- type UpdateCommandResult
Constants ¶
View Source
const RaftRPC = 1
*
- Leading byte in rpc, signifies, that it is a call
- to raft node (not grpc)
Variables ¶
View Source
var ErrMsgExist = errors.New("message exists")
View Source
var File_messages_internal_controller_distributed_commands_proto protoreflect.FileDescriptor
Functions ¶
This section is empty.
Types ¶
type AppendCommand ¶
type AppendCommand struct { Message *api.Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*AppendCommand) Descriptor
deprecated
func (*AppendCommand) Descriptor() ([]byte, []int)
Deprecated: Use AppendCommand.ProtoReflect.Descriptor instead.
func (*AppendCommand) GetMessage ¶
func (x *AppendCommand) GetMessage() *api.Message
func (*AppendCommand) ProtoMessage ¶
func (*AppendCommand) ProtoMessage()
func (*AppendCommand) ProtoReflect ¶
func (x *AppendCommand) ProtoReflect() protoreflect.Message
func (*AppendCommand) Reset ¶
func (x *AppendCommand) Reset()
func (*AppendCommand) String ¶
func (x *AppendCommand) String() string
type AppendCommandResult ¶
type AppendCommandResult struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
func (*AppendCommandResult) Descriptor
deprecated
func (*AppendCommandResult) Descriptor() ([]byte, []int)
Deprecated: Use AppendCommandResult.ProtoReflect.Descriptor instead.
func (*AppendCommandResult) GetId ¶
func (x *AppendCommandResult) GetId() int32
func (*AppendCommandResult) ProtoMessage ¶
func (*AppendCommandResult) ProtoMessage()
func (*AppendCommandResult) ProtoReflect ¶
func (x *AppendCommandResult) ProtoReflect() protoreflect.Message
func (*AppendCommandResult) Reset ¶
func (x *AppendCommandResult) Reset()
func (*AppendCommandResult) String ¶
func (x *AppendCommandResult) String() string
type DeleteCommand ¶
type DeleteCommand struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` UserId int32 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` FileId int32 `protobuf:"varint,3,opt,name=file_id,json=fileId,proto3" json:"file_id,omitempty"` // contains filtered or unexported fields }
func (*DeleteCommand) Descriptor
deprecated
func (*DeleteCommand) Descriptor() ([]byte, []int)
Deprecated: Use DeleteCommand.ProtoReflect.Descriptor instead.
func (*DeleteCommand) GetFileId ¶
func (x *DeleteCommand) GetFileId() int32
func (*DeleteCommand) GetId ¶
func (x *DeleteCommand) GetId() int32
func (*DeleteCommand) GetUserId ¶
func (x *DeleteCommand) GetUserId() int32
func (*DeleteCommand) ProtoMessage ¶
func (*DeleteCommand) ProtoMessage()
func (*DeleteCommand) ProtoReflect ¶
func (x *DeleteCommand) ProtoReflect() protoreflect.Message
func (*DeleteCommand) Reset ¶
func (x *DeleteCommand) Reset()
func (*DeleteCommand) String ¶
func (x *DeleteCommand) String() string
type DeleteCommandResult ¶
type DeleteCommandResult struct {
// contains filtered or unexported fields
}
func (*DeleteCommandResult) Descriptor
deprecated
func (*DeleteCommandResult) Descriptor() ([]byte, []int)
Deprecated: Use DeleteCommandResult.ProtoReflect.Descriptor instead.
func (*DeleteCommandResult) ProtoMessage ¶
func (*DeleteCommandResult) ProtoMessage()
func (*DeleteCommandResult) ProtoReflect ¶
func (x *DeleteCommandResult) ProtoReflect() protoreflect.Message
func (*DeleteCommandResult) Reset ¶
func (x *DeleteCommandResult) Reset()
func (*DeleteCommandResult) String ¶
func (x *DeleteCommandResult) String() string
type DistributedMessages ¶
type DistributedMessages struct {
// contains filtered or unexported fields
}
func New ¶
func New(repo Repository, cfg Config) (*DistributedMessages, error)
func (*DistributedMessages) DeleteMessage ¶
func (m *DistributedMessages) DeleteMessage(ctx context.Context, log *logger.Logger, params *model.DeleteMessageParams) error
func (*DistributedMessages) GetServers ¶
func (*DistributedMessages) Join ¶
func (m *DistributedMessages) Join(id, addr string) error
func (*DistributedMessages) Leave ¶
func (m *DistributedMessages) Leave(id string) error
func (*DistributedMessages) ReadUserMessages ¶
func (m *DistributedMessages) ReadUserMessages(ctx context.Context, log *logger.Logger, params *model.ReadUserMessagesParams) ( *model.ReadUserMessagesResult, error, )
func (*DistributedMessages) SaveMessage ¶
func (m *DistributedMessages) SaveMessage(ctx context.Context, log *logger.Logger, params *model.SaveMessageParams) error
func (*DistributedMessages) UpdateMessage ¶
func (m *DistributedMessages) UpdateMessage(ctx context.Context, log *logger.Logger, params *model.UpdateMessageParams) error
func (*DistributedMessages) WaitForLeader ¶
func (m *DistributedMessages) WaitForLeader(timeout time.Duration) error
type Repository ¶
type Repository interface { Create(ctx context.Context, log *logger.Logger, params *model.SaveMessageParams) error Update(ctx context.Context, log *logger.Logger, params *model.UpdateMessageParams) error Delete(ctx context.Context, log *logger.Logger, params *model.DeleteMessageParams) error ReadUserMessages(ctx context.Context, log *logger.Logger, params *model.ReadUserMessagesParams) (*model.ReadUserMessagesResult, error) GetBatch(ctx context.Context, log *logger.Logger) ([]*model.Message, error) Truncate(ctx context.Context, log *logger.Logger) error }
type RequestType ¶
type RequestType uint16
const ( AppendRequest RequestType = iota UpdateRequest DeleteRequest )
type StreamLayer ¶
type StreamLayer struct {
// contains filtered or unexported fields
}
func NewStreamLayer ¶
func NewStreamLayer(ln net.Listener) *StreamLayer
func (*StreamLayer) Addr ¶
func (s *StreamLayer) Addr() net.Addr
func (*StreamLayer) Close ¶
func (s *StreamLayer) Close() error
func (*StreamLayer) Dial ¶
func (s *StreamLayer) Dial(addr raft.ServerAddress, timeout time.Duration) ( net.Conn, error, )
type UpdateCommand ¶
type UpdateCommand struct { Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` UserId int32 `protobuf:"varint,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` FileId int32 `protobuf:"varint,3,opt,name=file_id,json=fileId,proto3" json:"file_id,omitempty"` Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"` UpdateUtcNano int64 `protobuf:"varint,5,opt,name=update_utc_nano,json=updateUtcNano,proto3" json:"update_utc_nano,omitempty"` // contains filtered or unexported fields }
func (*UpdateCommand) Descriptor
deprecated
func (*UpdateCommand) Descriptor() ([]byte, []int)
Deprecated: Use UpdateCommand.ProtoReflect.Descriptor instead.
func (*UpdateCommand) GetFileId ¶
func (x *UpdateCommand) GetFileId() int32
func (*UpdateCommand) GetId ¶
func (x *UpdateCommand) GetId() int32
func (*UpdateCommand) GetText ¶
func (x *UpdateCommand) GetText() string
func (*UpdateCommand) GetUpdateUtcNano ¶
func (x *UpdateCommand) GetUpdateUtcNano() int64
func (*UpdateCommand) GetUserId ¶
func (x *UpdateCommand) GetUserId() int32
func (*UpdateCommand) ProtoMessage ¶
func (*UpdateCommand) ProtoMessage()
func (*UpdateCommand) ProtoReflect ¶
func (x *UpdateCommand) ProtoReflect() protoreflect.Message
func (*UpdateCommand) Reset ¶
func (x *UpdateCommand) Reset()
func (*UpdateCommand) String ¶
func (x *UpdateCommand) String() string
type UpdateCommandResult ¶
type UpdateCommandResult struct {
// contains filtered or unexported fields
}
func (*UpdateCommandResult) Descriptor
deprecated
func (*UpdateCommandResult) Descriptor() ([]byte, []int)
Deprecated: Use UpdateCommandResult.ProtoReflect.Descriptor instead.
func (*UpdateCommandResult) ProtoMessage ¶
func (*UpdateCommandResult) ProtoMessage()
func (*UpdateCommandResult) ProtoReflect ¶
func (x *UpdateCommandResult) ProtoReflect() protoreflect.Message
func (*UpdateCommandResult) Reset ¶
func (x *UpdateCommandResult) Reset()
func (*UpdateCommandResult) String ¶
func (x *UpdateCommandResult) String() string
Click to show internal directories.
Click to hide internal directories.