consensusproto

package
v0.2.18 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthConsensus        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowConsensus          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupConsensus = fmt.Errorf("proto: unexpected end of group")
)
View Source
var ErrCodes_name = map[int32]string{
	0:   "Unexpected",
	1:   "LogExists",
	2:   "LogNotFound",
	3:   "RecordConflict",
	4:   "Forbidden",
	5:   "InvalidPayload",
	500: "ErrorOffset",
}
View Source
var ErrCodes_value = map[string]int32{
	"Unexpected":     0,
	"LogExists":      1,
	"LogNotFound":    2,
	"RecordConflict": 3,
	"Forbidden":      4,
	"InvalidPayload": 5,
	"ErrorOffset":    500,
}

Functions

func DRPCRegisterConsensus

func DRPCRegisterConsensus(mux drpc.Mux, impl DRPCConsensusServer) error

Types

type DRPCConsensusClient

type DRPCConsensusClient interface {
	DRPCConn() drpc.Conn

	LogAdd(ctx context.Context, in *LogAddRequest) (*Ok, error)
	RecordAdd(ctx context.Context, in *RecordAddRequest) (*RawRecordWithId, error)
	LogWatch(ctx context.Context) (DRPCConsensus_LogWatchClient, error)
}

func NewDRPCConsensusClient

func NewDRPCConsensusClient(cc drpc.Conn) DRPCConsensusClient

type DRPCConsensusDescription

type DRPCConsensusDescription struct{}

func (DRPCConsensusDescription) Method

func (DRPCConsensusDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool)

func (DRPCConsensusDescription) NumMethods

func (DRPCConsensusDescription) NumMethods() int

type DRPCConsensusServer

type DRPCConsensusServer interface {
	LogAdd(context.Context, *LogAddRequest) (*Ok, error)
	RecordAdd(context.Context, *RecordAddRequest) (*RawRecordWithId, error)
	LogWatch(DRPCConsensus_LogWatchStream) error
}

type DRPCConsensusUnimplementedServer

type DRPCConsensusUnimplementedServer struct{}

func (*DRPCConsensusUnimplementedServer) LogAdd

func (*DRPCConsensusUnimplementedServer) LogWatch

func (*DRPCConsensusUnimplementedServer) RecordAdd

type DRPCConsensus_LogAddStream

type DRPCConsensus_LogAddStream interface {
	drpc.Stream
	SendAndClose(*Ok) error
}

type DRPCConsensus_LogWatchClient

type DRPCConsensus_LogWatchClient interface {
	drpc.Stream
	Send(*LogWatchRequest) error
	Recv() (*LogWatchEvent, error)
}

type DRPCConsensus_LogWatchStream

type DRPCConsensus_LogWatchStream interface {
	drpc.Stream
	Send(*LogWatchEvent) error
	Recv() (*LogWatchRequest, error)
}

type DRPCConsensus_RecordAddStream

type DRPCConsensus_RecordAddStream interface {
	drpc.Stream
	SendAndClose(*RawRecordWithId) error
}

type Err

type Err struct {
	Error ErrCodes `protobuf:"varint,1,opt,name=error,proto3,enum=consensusProto.ErrCodes" json:"error,omitempty"`
}

func (*Err) Descriptor

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

func (*Err) GetError

func (m *Err) GetError() ErrCodes

func (*Err) Marshal

func (m *Err) Marshal() (dAtA []byte, err error)

func (*Err) MarshalTo

func (m *Err) MarshalTo(dAtA []byte) (int, error)

func (*Err) MarshalToSizedBuffer

func (m *Err) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Err) ProtoMessage

func (*Err) ProtoMessage()

func (*Err) Reset

func (m *Err) Reset()

func (*Err) Size

func (m *Err) Size() (n int)

func (*Err) String

func (m *Err) String() string

func (*Err) Unmarshal

func (m *Err) Unmarshal(dAtA []byte) error

func (*Err) XXX_DiscardUnknown

func (m *Err) XXX_DiscardUnknown()

func (*Err) XXX_Marshal

func (m *Err) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Err) XXX_Merge

func (m *Err) XXX_Merge(src proto.Message)

func (*Err) XXX_Size

func (m *Err) XXX_Size() int

func (*Err) XXX_Unmarshal

func (m *Err) XXX_Unmarshal(b []byte) error

type ErrCodes

type ErrCodes int32
const (
	ErrCodes_Unexpected     ErrCodes = 0
	ErrCodes_LogExists      ErrCodes = 1
	ErrCodes_LogNotFound    ErrCodes = 2
	ErrCodes_RecordConflict ErrCodes = 3
	ErrCodes_Forbidden      ErrCodes = 4
	ErrCodes_InvalidPayload ErrCodes = 5
	ErrCodes_ErrorOffset    ErrCodes = 500
)

func (ErrCodes) EnumDescriptor

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

func (ErrCodes) String

func (x ErrCodes) String() string

type Log

type Log struct {
	Id      string             `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Records []*RawRecordWithId `protobuf:"bytes,3,rep,name=records,proto3" json:"records,omitempty"`
}

func (*Log) Descriptor

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

func (*Log) GetId

func (m *Log) GetId() string

func (*Log) GetRecords

func (m *Log) GetRecords() []*RawRecordWithId

func (*Log) Marshal

func (m *Log) Marshal() (dAtA []byte, err error)

func (*Log) MarshalTo

func (m *Log) MarshalTo(dAtA []byte) (int, error)

func (*Log) MarshalToSizedBuffer

func (m *Log) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Log) ProtoMessage

func (*Log) ProtoMessage()

func (*Log) Reset

func (m *Log) Reset()

func (*Log) Size

func (m *Log) Size() (n int)

func (*Log) String

func (m *Log) String() string

func (*Log) Unmarshal

func (m *Log) Unmarshal(dAtA []byte) error

func (*Log) XXX_DiscardUnknown

func (m *Log) XXX_DiscardUnknown()

func (*Log) XXX_Marshal

func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Log) XXX_Merge

func (m *Log) XXX_Merge(src proto.Message)

func (*Log) XXX_Size

func (m *Log) XXX_Size() int

func (*Log) XXX_Unmarshal

func (m *Log) XXX_Unmarshal(b []byte) error

type LogAddRequest

type LogAddRequest struct {
	// first record in the log, consensus node not sign it
	Record *RawRecordWithId `protobuf:"bytes,1,opt,name=record,proto3" json:"record,omitempty"`
}

func (*LogAddRequest) Descriptor

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

func (*LogAddRequest) GetRecord added in v0.2.15

func (m *LogAddRequest) GetRecord() *RawRecordWithId

func (*LogAddRequest) Marshal

func (m *LogAddRequest) Marshal() (dAtA []byte, err error)

func (*LogAddRequest) MarshalTo

func (m *LogAddRequest) MarshalTo(dAtA []byte) (int, error)

func (*LogAddRequest) MarshalToSizedBuffer

func (m *LogAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*LogAddRequest) ProtoMessage

func (*LogAddRequest) ProtoMessage()

func (*LogAddRequest) Reset

func (m *LogAddRequest) Reset()

func (*LogAddRequest) Size

func (m *LogAddRequest) Size() (n int)

func (*LogAddRequest) String

func (m *LogAddRequest) String() string

func (*LogAddRequest) Unmarshal

func (m *LogAddRequest) Unmarshal(dAtA []byte) error

func (*LogAddRequest) XXX_DiscardUnknown

func (m *LogAddRequest) XXX_DiscardUnknown()

func (*LogAddRequest) XXX_Marshal

func (m *LogAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LogAddRequest) XXX_Merge

func (m *LogAddRequest) XXX_Merge(src proto.Message)

func (*LogAddRequest) XXX_Size

func (m *LogAddRequest) XXX_Size() int

func (*LogAddRequest) XXX_Unmarshal

func (m *LogAddRequest) XXX_Unmarshal(b []byte) error

type LogWatchEvent

type LogWatchEvent struct {
	LogId   string             `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
	Records []*RawRecordWithId `protobuf:"bytes,2,rep,name=records,proto3" json:"records,omitempty"`
	Error   *Err               `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"`
}

func (*LogWatchEvent) Descriptor

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

func (*LogWatchEvent) GetError

func (m *LogWatchEvent) GetError() *Err

func (*LogWatchEvent) GetLogId

func (m *LogWatchEvent) GetLogId() string

func (*LogWatchEvent) GetRecords

func (m *LogWatchEvent) GetRecords() []*RawRecordWithId

func (*LogWatchEvent) Marshal

func (m *LogWatchEvent) Marshal() (dAtA []byte, err error)

func (*LogWatchEvent) MarshalTo

func (m *LogWatchEvent) MarshalTo(dAtA []byte) (int, error)

func (*LogWatchEvent) MarshalToSizedBuffer

func (m *LogWatchEvent) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*LogWatchEvent) ProtoMessage

func (*LogWatchEvent) ProtoMessage()

func (*LogWatchEvent) Reset

func (m *LogWatchEvent) Reset()

func (*LogWatchEvent) Size

func (m *LogWatchEvent) Size() (n int)

func (*LogWatchEvent) String

func (m *LogWatchEvent) String() string

func (*LogWatchEvent) Unmarshal

func (m *LogWatchEvent) Unmarshal(dAtA []byte) error

func (*LogWatchEvent) XXX_DiscardUnknown

func (m *LogWatchEvent) XXX_DiscardUnknown()

func (*LogWatchEvent) XXX_Marshal

func (m *LogWatchEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LogWatchEvent) XXX_Merge

func (m *LogWatchEvent) XXX_Merge(src proto.Message)

func (*LogWatchEvent) XXX_Size

func (m *LogWatchEvent) XXX_Size() int

func (*LogWatchEvent) XXX_Unmarshal

func (m *LogWatchEvent) XXX_Unmarshal(b []byte) error

type LogWatchRequest

type LogWatchRequest struct {
	WatchIds   []string `protobuf:"bytes,1,rep,name=watchIds,proto3" json:"watchIds,omitempty"`
	UnwatchIds []string `protobuf:"bytes,2,rep,name=unwatchIds,proto3" json:"unwatchIds,omitempty"`
}

func (*LogWatchRequest) Descriptor

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

func (*LogWatchRequest) GetUnwatchIds

func (m *LogWatchRequest) GetUnwatchIds() []string

func (*LogWatchRequest) GetWatchIds

func (m *LogWatchRequest) GetWatchIds() []string

func (*LogWatchRequest) Marshal

func (m *LogWatchRequest) Marshal() (dAtA []byte, err error)

func (*LogWatchRequest) MarshalTo

func (m *LogWatchRequest) MarshalTo(dAtA []byte) (int, error)

func (*LogWatchRequest) MarshalToSizedBuffer

func (m *LogWatchRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*LogWatchRequest) ProtoMessage

func (*LogWatchRequest) ProtoMessage()

func (*LogWatchRequest) Reset

func (m *LogWatchRequest) Reset()

func (*LogWatchRequest) Size

func (m *LogWatchRequest) Size() (n int)

func (*LogWatchRequest) String

func (m *LogWatchRequest) String() string

func (*LogWatchRequest) Unmarshal

func (m *LogWatchRequest) Unmarshal(dAtA []byte) error

func (*LogWatchRequest) XXX_DiscardUnknown

func (m *LogWatchRequest) XXX_DiscardUnknown()

func (*LogWatchRequest) XXX_Marshal

func (m *LogWatchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LogWatchRequest) XXX_Merge

func (m *LogWatchRequest) XXX_Merge(src proto.Message)

func (*LogWatchRequest) XXX_Size

func (m *LogWatchRequest) XXX_Size() int

func (*LogWatchRequest) XXX_Unmarshal

func (m *LogWatchRequest) XXX_Unmarshal(b []byte) error

type Ok

type Ok struct {
}

func (*Ok) Descriptor

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

func (*Ok) Marshal

func (m *Ok) Marshal() (dAtA []byte, err error)

func (*Ok) MarshalTo

func (m *Ok) MarshalTo(dAtA []byte) (int, error)

func (*Ok) MarshalToSizedBuffer

func (m *Ok) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Ok) ProtoMessage

func (*Ok) ProtoMessage()

func (*Ok) Reset

func (m *Ok) Reset()

func (*Ok) Size

func (m *Ok) Size() (n int)

func (*Ok) String

func (m *Ok) String() string

func (*Ok) Unmarshal

func (m *Ok) Unmarshal(dAtA []byte) error

func (*Ok) XXX_DiscardUnknown

func (m *Ok) XXX_DiscardUnknown()

func (*Ok) XXX_Marshal

func (m *Ok) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Ok) XXX_Merge

func (m *Ok) XXX_Merge(src proto.Message)

func (*Ok) XXX_Size

func (m *Ok) XXX_Size() int

func (*Ok) XXX_Unmarshal

func (m *Ok) XXX_Unmarshal(b []byte) error

type RawRecord

type RawRecord struct {
	Payload           []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	Signature         []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	AcceptorIdentity  []byte `protobuf:"bytes,3,opt,name=acceptorIdentity,proto3" json:"acceptorIdentity,omitempty"`
	AcceptorSignature []byte `protobuf:"bytes,4,opt,name=acceptorSignature,proto3" json:"acceptorSignature,omitempty"`
}

RawRecord is a proto message containing the payload in bytes, signature of the account who added it and signature of the acceptor

func (*RawRecord) Descriptor

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

func (*RawRecord) GetAcceptorIdentity

func (m *RawRecord) GetAcceptorIdentity() []byte

func (*RawRecord) GetAcceptorSignature

func (m *RawRecord) GetAcceptorSignature() []byte

func (*RawRecord) GetPayload

func (m *RawRecord) GetPayload() []byte

func (*RawRecord) GetSignature

func (m *RawRecord) GetSignature() []byte

func (*RawRecord) Marshal

func (m *RawRecord) Marshal() (dAtA []byte, err error)

func (*RawRecord) MarshalTo

func (m *RawRecord) MarshalTo(dAtA []byte) (int, error)

func (*RawRecord) MarshalToSizedBuffer

func (m *RawRecord) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RawRecord) ProtoMessage

func (*RawRecord) ProtoMessage()

func (*RawRecord) Reset

func (m *RawRecord) Reset()

func (*RawRecord) Size

func (m *RawRecord) Size() (n int)

func (*RawRecord) String

func (m *RawRecord) String() string

func (*RawRecord) Unmarshal

func (m *RawRecord) Unmarshal(dAtA []byte) error

func (*RawRecord) XXX_DiscardUnknown

func (m *RawRecord) XXX_DiscardUnknown()

func (*RawRecord) XXX_Marshal

func (m *RawRecord) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RawRecord) XXX_Merge

func (m *RawRecord) XXX_Merge(src proto.Message)

func (*RawRecord) XXX_Size

func (m *RawRecord) XXX_Size() int

func (*RawRecord) XXX_Unmarshal

func (m *RawRecord) XXX_Unmarshal(b []byte) error

type RawRecordWithId

type RawRecordWithId struct {
	Payload []byte `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"`
	Id      string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"`
}

RawRecordWithId is a raw record and the id for convenience

func (*RawRecordWithId) Descriptor

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

func (*RawRecordWithId) GetId

func (m *RawRecordWithId) GetId() string

func (*RawRecordWithId) GetPayload

func (m *RawRecordWithId) GetPayload() []byte

func (*RawRecordWithId) Marshal

func (m *RawRecordWithId) Marshal() (dAtA []byte, err error)

func (*RawRecordWithId) MarshalTo

func (m *RawRecordWithId) MarshalTo(dAtA []byte) (int, error)

func (*RawRecordWithId) MarshalToSizedBuffer

func (m *RawRecordWithId) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RawRecordWithId) ProtoMessage

func (*RawRecordWithId) ProtoMessage()

func (*RawRecordWithId) Reset

func (m *RawRecordWithId) Reset()

func (*RawRecordWithId) Size

func (m *RawRecordWithId) Size() (n int)

func (*RawRecordWithId) String

func (m *RawRecordWithId) String() string

func (*RawRecordWithId) Unmarshal

func (m *RawRecordWithId) Unmarshal(dAtA []byte) error

func (*RawRecordWithId) XXX_DiscardUnknown

func (m *RawRecordWithId) XXX_DiscardUnknown()

func (*RawRecordWithId) XXX_Marshal

func (m *RawRecordWithId) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RawRecordWithId) XXX_Merge

func (m *RawRecordWithId) XXX_Merge(src proto.Message)

func (*RawRecordWithId) XXX_Size

func (m *RawRecordWithId) XXX_Size() int

func (*RawRecordWithId) XXX_Unmarshal

func (m *RawRecordWithId) XXX_Unmarshal(b []byte) error

type Record

type Record struct {
	PrevId    string `protobuf:"bytes,1,opt,name=prevId,proto3" json:"prevId,omitempty"`
	Identity  []byte `protobuf:"bytes,2,opt,name=identity,proto3" json:"identity,omitempty"`
	Data      []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
	Timestamp int64  `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
}

Record is a record containing a data

func (*Record) Descriptor

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

func (*Record) GetData

func (m *Record) GetData() []byte

func (*Record) GetIdentity

func (m *Record) GetIdentity() []byte

func (*Record) GetPrevId

func (m *Record) GetPrevId() string

func (*Record) GetTimestamp

func (m *Record) GetTimestamp() int64

func (*Record) Marshal

func (m *Record) Marshal() (dAtA []byte, err error)

func (*Record) MarshalTo

func (m *Record) MarshalTo(dAtA []byte) (int, error)

func (*Record) MarshalToSizedBuffer

func (m *Record) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Record) ProtoMessage

func (*Record) ProtoMessage()

func (*Record) Reset

func (m *Record) Reset()

func (*Record) Size

func (m *Record) Size() (n int)

func (*Record) String

func (m *Record) String() string

func (*Record) Unmarshal

func (m *Record) Unmarshal(dAtA []byte) error

func (*Record) XXX_DiscardUnknown

func (m *Record) XXX_DiscardUnknown()

func (*Record) XXX_Marshal

func (m *Record) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Record) XXX_Merge

func (m *Record) XXX_Merge(src proto.Message)

func (*Record) XXX_Size

func (m *Record) XXX_Size() int

func (*Record) XXX_Unmarshal

func (m *Record) XXX_Unmarshal(b []byte) error

type RecordAddRequest

type RecordAddRequest struct {
	LogId  string     `protobuf:"bytes,1,opt,name=logId,proto3" json:"logId,omitempty"`
	Record *RawRecord `protobuf:"bytes,2,opt,name=record,proto3" json:"record,omitempty"`
}

func (*RecordAddRequest) Descriptor

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

func (*RecordAddRequest) GetLogId

func (m *RecordAddRequest) GetLogId() string

func (*RecordAddRequest) GetRecord

func (m *RecordAddRequest) GetRecord() *RawRecord

func (*RecordAddRequest) Marshal

func (m *RecordAddRequest) Marshal() (dAtA []byte, err error)

func (*RecordAddRequest) MarshalTo

func (m *RecordAddRequest) MarshalTo(dAtA []byte) (int, error)

func (*RecordAddRequest) MarshalToSizedBuffer

func (m *RecordAddRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RecordAddRequest) ProtoMessage

func (*RecordAddRequest) ProtoMessage()

func (*RecordAddRequest) Reset

func (m *RecordAddRequest) Reset()

func (*RecordAddRequest) Size

func (m *RecordAddRequest) Size() (n int)

func (*RecordAddRequest) String

func (m *RecordAddRequest) String() string

func (*RecordAddRequest) Unmarshal

func (m *RecordAddRequest) Unmarshal(dAtA []byte) error

func (*RecordAddRequest) XXX_DiscardUnknown

func (m *RecordAddRequest) XXX_DiscardUnknown()

func (*RecordAddRequest) XXX_Marshal

func (m *RecordAddRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RecordAddRequest) XXX_Merge

func (m *RecordAddRequest) XXX_Merge(src proto.Message)

func (*RecordAddRequest) XXX_Size

func (m *RecordAddRequest) XXX_Size() int

func (*RecordAddRequest) XXX_Unmarshal

func (m *RecordAddRequest) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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