Documentation
¶
Overview ¶
Package kronospb is a generated protocol buffer package.
It is generated from these files:
kronos/pb/drift_service.proto kronos/pb/kronos.proto
It has these top-level messages:
DriftTimeConfig DriftTimeResponse NodeAddr OracleState OracleProposal Node Cluster OracleTimeRequest OracleTimeResponse KronosTimeRequest KronosTimeResponse StatusRequest StatusResponse
Index ¶
- Variables
- func RegisterTimeServiceServer(s *grpc.Server, srv TimeServiceServer)
- func RegisterUpdateDriftTimeServiceServer(s *grpc.Server, srv UpdateDriftTimeServiceServer)
- type Cluster
- func (*Cluster) Descriptor() ([]byte, []int)
- func (m *Cluster) Marshal() (dAtA []byte, err error)
- func (m *Cluster) MarshalTo(dAtA []byte) (int, error)
- func (*Cluster) ProtoMessage()
- func (m *Cluster) Reset()
- func (m *Cluster) Size() (n int)
- func (m *Cluster) String() string
- func (m *Cluster) Unmarshal(dAtA []byte) error
- type DriftTimeConfig
- func (*DriftTimeConfig) Descriptor() ([]byte, []int)
- func (m *DriftTimeConfig) Marshal() (dAtA []byte, err error)
- func (m *DriftTimeConfig) MarshalTo(dAtA []byte) (int, error)
- func (*DriftTimeConfig) ProtoMessage()
- func (m *DriftTimeConfig) Reset()
- func (m *DriftTimeConfig) Size() (n int)
- func (m *DriftTimeConfig) String() string
- func (m *DriftTimeConfig) Unmarshal(dAtA []byte) error
- type DriftTimeResponse
- func (*DriftTimeResponse) Descriptor() ([]byte, []int)
- func (m *DriftTimeResponse) Marshal() (dAtA []byte, err error)
- func (m *DriftTimeResponse) MarshalTo(dAtA []byte) (int, error)
- func (*DriftTimeResponse) ProtoMessage()
- func (m *DriftTimeResponse) Reset()
- func (m *DriftTimeResponse) Size() (n int)
- func (m *DriftTimeResponse) String() string
- func (m *DriftTimeResponse) Unmarshal(dAtA []byte) error
- type KronosTimeRequest
- func (*KronosTimeRequest) Descriptor() ([]byte, []int)
- func (m *KronosTimeRequest) Marshal() (dAtA []byte, err error)
- func (m *KronosTimeRequest) MarshalTo(dAtA []byte) (int, error)
- func (*KronosTimeRequest) ProtoMessage()
- func (m *KronosTimeRequest) Reset()
- func (m *KronosTimeRequest) Size() (n int)
- func (m *KronosTimeRequest) String() string
- func (m *KronosTimeRequest) Unmarshal(dAtA []byte) error
- type KronosTimeResponse
- func (*KronosTimeResponse) Descriptor() ([]byte, []int)
- func (m *KronosTimeResponse) Marshal() (dAtA []byte, err error)
- func (m *KronosTimeResponse) MarshalTo(dAtA []byte) (int, error)
- func (*KronosTimeResponse) ProtoMessage()
- func (m *KronosTimeResponse) Reset()
- func (m *KronosTimeResponse) Size() (n int)
- func (m *KronosTimeResponse) String() string
- func (m *KronosTimeResponse) Unmarshal(dAtA []byte) error
- type Node
- type NodeAddr
- func (*NodeAddr) Descriptor() ([]byte, []int)
- func (m *NodeAddr) Marshal() (dAtA []byte, err error)
- func (m *NodeAddr) MarshalTo(dAtA []byte) (int, error)
- func (*NodeAddr) ProtoMessage()
- func (m *NodeAddr) Reset()
- func (m *NodeAddr) Size() (n int)
- func (m *NodeAddr) String() string
- func (m *NodeAddr) Unmarshal(dAtA []byte) error
- type OracleProposal
- func (*OracleProposal) Descriptor() ([]byte, []int)
- func (m *OracleProposal) Marshal() (dAtA []byte, err error)
- func (m *OracleProposal) MarshalTo(dAtA []byte) (int, error)
- func (*OracleProposal) ProtoMessage()
- func (m *OracleProposal) Reset()
- func (m *OracleProposal) Size() (n int)
- func (m *OracleProposal) String() string
- func (m *OracleProposal) Unmarshal(dAtA []byte) error
- type OracleState
- func (*OracleState) Descriptor() ([]byte, []int)
- func (m *OracleState) Marshal() (dAtA []byte, err error)
- func (m *OracleState) MarshalTo(dAtA []byte) (int, error)
- func (*OracleState) ProtoMessage()
- func (m *OracleState) Reset()
- func (m *OracleState) Size() (n int)
- func (m *OracleState) String() string
- func (m *OracleState) Unmarshal(dAtA []byte) error
- type OracleTimeRequest
- func (*OracleTimeRequest) Descriptor() ([]byte, []int)
- func (m *OracleTimeRequest) Marshal() (dAtA []byte, err error)
- func (m *OracleTimeRequest) MarshalTo(dAtA []byte) (int, error)
- func (*OracleTimeRequest) ProtoMessage()
- func (m *OracleTimeRequest) Reset()
- func (m *OracleTimeRequest) Size() (n int)
- func (m *OracleTimeRequest) String() string
- func (m *OracleTimeRequest) Unmarshal(dAtA []byte) error
- type OracleTimeResponse
- func (*OracleTimeResponse) Descriptor() ([]byte, []int)
- func (m *OracleTimeResponse) Marshal() (dAtA []byte, err error)
- func (m *OracleTimeResponse) MarshalTo(dAtA []byte) (int, error)
- func (*OracleTimeResponse) ProtoMessage()
- func (m *OracleTimeResponse) Reset()
- func (m *OracleTimeResponse) Size() (n int)
- func (m *OracleTimeResponse) String() string
- func (m *OracleTimeResponse) Unmarshal(dAtA []byte) error
- type ServerStatus
- type StatusRequest
- func (*StatusRequest) Descriptor() ([]byte, []int)
- func (m *StatusRequest) Marshal() (dAtA []byte, err error)
- func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error)
- func (*StatusRequest) ProtoMessage()
- func (m *StatusRequest) Reset()
- func (m *StatusRequest) Size() (n int)
- func (m *StatusRequest) String() string
- func (m *StatusRequest) Unmarshal(dAtA []byte) error
- type StatusResponse
- func (*StatusResponse) Descriptor() ([]byte, []int)
- func (m *StatusResponse) Marshal() (dAtA []byte, err error)
- func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error)
- func (*StatusResponse) ProtoMessage()
- func (m *StatusResponse) Reset()
- func (m *StatusResponse) Size() (n int)
- func (m *StatusResponse) String() string
- func (m *StatusResponse) Unmarshal(dAtA []byte) error
- type TimeServiceClient
- type TimeServiceServer
- type UpdateDriftTimeServiceClient
- type UpdateDriftTimeServiceServer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidLengthDriftService = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowDriftService = fmt.Errorf("proto: integer overflow") )
View Source
var ( ErrInvalidLengthKronos = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowKronos = fmt.Errorf("proto: integer overflow") )
View Source
var ServerStatus_name = map[int32]string{
0: "NOT_INITIALIZED",
1: "INITIALIZED",
}
View Source
var ServerStatus_value = map[string]int32{
"NOT_INITIALIZED": 0,
"INITIALIZED": 1,
}
Functions ¶
func RegisterTimeServiceServer ¶
func RegisterTimeServiceServer(s *grpc.Server, srv TimeServiceServer)
func RegisterUpdateDriftTimeServiceServer ¶
func RegisterUpdateDriftTimeServiceServer(s *grpc.Server, srv UpdateDriftTimeServiceServer)
Types ¶
type Cluster ¶
type Cluster struct {
// all_nodes is a map of NodeId -> Node metadata. This is the same id which is
// used by raft.
// This map contains both active nodes and nodes removed from the cluster.
AllNodes map[string]*Node `` /* 159-byte string literal not displayed */
}
Cluster stores the information about cluster that is persisted on each node.
func (*Cluster) Descriptor ¶
func (*Cluster) ProtoMessage ¶
func (*Cluster) ProtoMessage()
type DriftTimeConfig ¶
type DriftTimeConfig struct {
// DriftFactor controls the rate of flow of drifting clock. eg. DriftFactor
// of 1.1 means 1 second duration of system time will translate to 1.1
// second with drifting clock.
DriftFactor float64 `protobuf:"fixed64,1,opt,name=DriftFactor,proto3" json:"DriftFactor,omitempty"`
// Offset is used to jump the clock by offset nanoseconds
Offset int64 `protobuf:"varint,2,opt,name=Offset,proto3" json:"Offset,omitempty"`
}
func (*DriftTimeConfig) Descriptor ¶
func (*DriftTimeConfig) Descriptor() ([]byte, []int)
func (*DriftTimeConfig) Marshal ¶
func (m *DriftTimeConfig) Marshal() (dAtA []byte, err error)
func (*DriftTimeConfig) ProtoMessage ¶
func (*DriftTimeConfig) ProtoMessage()
func (*DriftTimeConfig) Reset ¶
func (m *DriftTimeConfig) Reset()
func (*DriftTimeConfig) Size ¶
func (m *DriftTimeConfig) Size() (n int)
func (*DriftTimeConfig) String ¶
func (m *DriftTimeConfig) String() string
func (*DriftTimeConfig) Unmarshal ¶
func (m *DriftTimeConfig) Unmarshal(dAtA []byte) error
type DriftTimeResponse ¶
type DriftTimeResponse struct {
}
func (*DriftTimeResponse) Descriptor ¶
func (*DriftTimeResponse) Descriptor() ([]byte, []int)
func (*DriftTimeResponse) Marshal ¶
func (m *DriftTimeResponse) Marshal() (dAtA []byte, err error)
func (*DriftTimeResponse) MarshalTo ¶
func (m *DriftTimeResponse) MarshalTo(dAtA []byte) (int, error)
func (*DriftTimeResponse) ProtoMessage ¶
func (*DriftTimeResponse) ProtoMessage()
func (*DriftTimeResponse) Reset ¶
func (m *DriftTimeResponse) Reset()
func (*DriftTimeResponse) Size ¶
func (m *DriftTimeResponse) Size() (n int)
func (*DriftTimeResponse) String ¶
func (m *DriftTimeResponse) String() string
func (*DriftTimeResponse) Unmarshal ¶
func (m *DriftTimeResponse) Unmarshal(dAtA []byte) error
type KronosTimeRequest ¶
type KronosTimeRequest struct {
}
func (*KronosTimeRequest) Descriptor ¶
func (*KronosTimeRequest) Descriptor() ([]byte, []int)
func (*KronosTimeRequest) Marshal ¶
func (m *KronosTimeRequest) Marshal() (dAtA []byte, err error)
func (*KronosTimeRequest) MarshalTo ¶
func (m *KronosTimeRequest) MarshalTo(dAtA []byte) (int, error)
func (*KronosTimeRequest) ProtoMessage ¶
func (*KronosTimeRequest) ProtoMessage()
func (*KronosTimeRequest) Reset ¶
func (m *KronosTimeRequest) Reset()
func (*KronosTimeRequest) Size ¶
func (m *KronosTimeRequest) Size() (n int)
func (*KronosTimeRequest) String ¶
func (m *KronosTimeRequest) String() string
func (*KronosTimeRequest) Unmarshal ¶
func (m *KronosTimeRequest) Unmarshal(dAtA []byte) error
type KronosTimeResponse ¶
type KronosTimeResponse struct {
// time is the KronosTime
Time int64 `protobuf:"varint,1,opt,name=time,proto3" json:"time,omitempty"`
// time_cap is an upper bound to KronosTime. This is periodically updated by
// the oracle. If the oracle goes down and no new oracle is elected, or if
// quorum is lost in the cluster, time_cap is used to as a safety measure so
// that clusters stop serving time. Any time greater than time_cap may not be
// reliable and not close to actual KronosTime.
TimeCap int64 `protobuf:"varint,2,opt,name=time_cap,json=timeCap,proto3" json:"time_cap,omitempty"`
// rtt is the round-trip time for the rpc. this is actually filled on the
// client side.
Rtt int64 `protobuf:"varint,3,opt,name=rtt,proto3" json:"rtt,omitempty"`
}
func (*KronosTimeResponse) Descriptor ¶
func (*KronosTimeResponse) Descriptor() ([]byte, []int)
func (*KronosTimeResponse) Marshal ¶
func (m *KronosTimeResponse) Marshal() (dAtA []byte, err error)
func (*KronosTimeResponse) MarshalTo ¶
func (m *KronosTimeResponse) MarshalTo(dAtA []byte) (int, error)
func (*KronosTimeResponse) ProtoMessage ¶
func (*KronosTimeResponse) ProtoMessage()
func (*KronosTimeResponse) Reset ¶
func (m *KronosTimeResponse) Reset()
func (*KronosTimeResponse) Size ¶
func (m *KronosTimeResponse) Size() (n int)
func (*KronosTimeResponse) String ¶
func (m *KronosTimeResponse) String() string
func (*KronosTimeResponse) Unmarshal ¶
func (m *KronosTimeResponse) Unmarshal(dAtA []byte) error
type Node ¶
type Node struct {
// raft_addr is the address of raft transport of the node.
RaftAddr *NodeAddr `protobuf:"bytes,1,opt,name=raft_addr,json=raftAddr" json:"raft_addr,omitempty"`
// is_removed is true for nodes which have been removed from the kronos raft
// cluster. Removed node IDs cannot be added back to the cluster.
IsRemoved bool `protobuf:"varint,2,opt,name=is_removed,json=isRemoved,proto3" json:"is_removed,omitempty"`
}
Node stores the data of a single node that is persisted in cluster info on each node.
func (*Node) Descriptor ¶
func (*Node) ProtoMessage ¶
func (*Node) ProtoMessage()
type NodeAddr ¶
type NodeAddr struct {
// Host of the node address
Host string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
// Port of the node address
Port string `protobuf:"bytes,2,opt,name=port,proto3" json:"port,omitempty"`
}
func (*NodeAddr) Descriptor ¶
func (*NodeAddr) ProtoMessage ¶
func (*NodeAddr) ProtoMessage()
type OracleProposal ¶
type OracleProposal struct {
// Proposal to update the oracle
ProposedState *OracleState `protobuf:"bytes,1,opt,name=proposed_state,json=proposedState" json:"proposed_state,omitempty"`
}
func (*OracleProposal) Descriptor ¶
func (*OracleProposal) Descriptor() ([]byte, []int)
func (*OracleProposal) Marshal ¶
func (m *OracleProposal) Marshal() (dAtA []byte, err error)
func (*OracleProposal) ProtoMessage ¶
func (*OracleProposal) ProtoMessage()
func (*OracleProposal) Reset ¶
func (m *OracleProposal) Reset()
func (*OracleProposal) Size ¶
func (m *OracleProposal) Size() (n int)
func (*OracleProposal) String ¶
func (m *OracleProposal) String() string
func (*OracleProposal) Unmarshal ¶
func (m *OracleProposal) Unmarshal(dAtA []byte) error
type OracleState ¶
type OracleState struct {
// Current id. This is used for CAS operations
// id is a sequence
Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
// Upper bound to time generated by Kronos
TimeCap int64 `protobuf:"varint,2,opt,name=time_cap,json=timeCap,proto3" json:"time_cap,omitempty"`
// Address of current oracle
Oracle *NodeAddr `protobuf:"bytes,3,opt,name=oracle" json:"oracle,omitempty"`
}
func (*OracleState) Descriptor ¶
func (*OracleState) Descriptor() ([]byte, []int)
func (*OracleState) Marshal ¶
func (m *OracleState) Marshal() (dAtA []byte, err error)
func (*OracleState) ProtoMessage ¶
func (*OracleState) ProtoMessage()
func (*OracleState) Reset ¶
func (m *OracleState) Reset()
func (*OracleState) Size ¶
func (m *OracleState) Size() (n int)
func (*OracleState) String ¶
func (m *OracleState) String() string
func (*OracleState) Unmarshal ¶
func (m *OracleState) Unmarshal(dAtA []byte) error
type OracleTimeRequest ¶
type OracleTimeRequest struct {
}
func (*OracleTimeRequest) Descriptor ¶
func (*OracleTimeRequest) Descriptor() ([]byte, []int)
func (*OracleTimeRequest) Marshal ¶
func (m *OracleTimeRequest) Marshal() (dAtA []byte, err error)
func (*OracleTimeRequest) MarshalTo ¶
func (m *OracleTimeRequest) MarshalTo(dAtA []byte) (int, error)
func (*OracleTimeRequest) ProtoMessage ¶
func (*OracleTimeRequest) ProtoMessage()
func (*OracleTimeRequest) Reset ¶
func (m *OracleTimeRequest) Reset()
func (*OracleTimeRequest) Size ¶
func (m *OracleTimeRequest) Size() (n int)
func (*OracleTimeRequest) String ¶
func (m *OracleTimeRequest) String() string
func (*OracleTimeRequest) Unmarshal ¶
func (m *OracleTimeRequest) Unmarshal(dAtA []byte) error
type OracleTimeResponse ¶
type OracleTimeResponse struct {
// time is the KronosTime of the oracle.
Time int64 `protobuf:"varint,1,opt,name=time,proto3" json:"time,omitempty"`
// rtt is the round-trip time for the rpc. this is actually filled on the
// client side.
Rtt int64 `protobuf:"varint,2,opt,name=rtt,proto3" json:"rtt,omitempty"`
}
func (*OracleTimeResponse) Descriptor ¶
func (*OracleTimeResponse) Descriptor() ([]byte, []int)
func (*OracleTimeResponse) Marshal ¶
func (m *OracleTimeResponse) Marshal() (dAtA []byte, err error)
func (*OracleTimeResponse) MarshalTo ¶
func (m *OracleTimeResponse) MarshalTo(dAtA []byte) (int, error)
func (*OracleTimeResponse) ProtoMessage ¶
func (*OracleTimeResponse) ProtoMessage()
func (*OracleTimeResponse) Reset ¶
func (m *OracleTimeResponse) Reset()
func (*OracleTimeResponse) Size ¶
func (m *OracleTimeResponse) Size() (n int)
func (*OracleTimeResponse) String ¶
func (m *OracleTimeResponse) String() string
func (*OracleTimeResponse) Unmarshal ¶
func (m *OracleTimeResponse) Unmarshal(dAtA []byte) error
type ServerStatus ¶
type ServerStatus int32
const ( // Server is not the oracle and has not synced with the oracle // It cannot respond to KronosTime requests ServerStatus_NOT_INITIALIZED ServerStatus = 0 // Server is the oracle or has synced with any oracle // It can respond to KronosTime requests if it is the current oracle. // KronosTime of initialized servers are valid ServerStatus_INITIALIZED ServerStatus = 1 )
func (ServerStatus) EnumDescriptor ¶
func (ServerStatus) EnumDescriptor() ([]byte, []int)
func (ServerStatus) String ¶
func (x ServerStatus) String() string
type StatusRequest ¶
type StatusRequest struct {
}
func (*StatusRequest) Descriptor ¶
func (*StatusRequest) Descriptor() ([]byte, []int)
func (*StatusRequest) Marshal ¶
func (m *StatusRequest) Marshal() (dAtA []byte, err error)
func (*StatusRequest) ProtoMessage ¶
func (*StatusRequest) ProtoMessage()
func (*StatusRequest) Reset ¶
func (m *StatusRequest) Reset()
func (*StatusRequest) Size ¶
func (m *StatusRequest) Size() (n int)
func (*StatusRequest) String ¶
func (m *StatusRequest) String() string
func (*StatusRequest) Unmarshal ¶
func (m *StatusRequest) Unmarshal(dAtA []byte) error
type StatusResponse ¶
type StatusResponse struct {
ServerStatus ServerStatus `protobuf:"varint,1,opt,name=server_status,json=serverStatus,proto3,enum=kronospb.ServerStatus" json:"server_status,omitempty"`
OracleState *OracleState `protobuf:"bytes,2,opt,name=oracle_state,json=oracleState" json:"oracle_state,omitempty"`
Delta int64 `protobuf:"varint,3,opt,name=delta,proto3" json:"delta,omitempty"`
}
func (*StatusResponse) Descriptor ¶
func (*StatusResponse) Descriptor() ([]byte, []int)
func (*StatusResponse) Marshal ¶
func (m *StatusResponse) Marshal() (dAtA []byte, err error)
func (*StatusResponse) ProtoMessage ¶
func (*StatusResponse) ProtoMessage()
func (*StatusResponse) Reset ¶
func (m *StatusResponse) Reset()
func (*StatusResponse) Size ¶
func (m *StatusResponse) Size() (n int)
func (*StatusResponse) String ¶
func (m *StatusResponse) String() string
func (*StatusResponse) Unmarshal ¶
func (m *StatusResponse) Unmarshal(dAtA []byte) error
type TimeServiceClient ¶
type TimeServiceClient interface {
// OracleTime returns the server's KronosTime if the server believes it is
// the oracle, otherwise it returns an error.
// A distributed state machine is used to store the identity of the oracle
// and it is used by the server to know if it should respond to OracleTime
// requests.
// This RPC is used internally by kronos nodes to sync time with the elected
// oracle.
// This returns an error if
// 1. The server is not the current oracle.
// 2. The server is not initialized.
// 3. The server's KronosTime is stale (KronosTime > Time Cap). This can
// mean that the cluster has lost a quorum of the nodes.
OracleTime(ctx context.Context, in *OracleTimeRequest, opts ...grpc.CallOption) (*OracleTimeResponse, error)
// KronosTime returns the server's KronosTime. An application can call this
// RPC on the local kronos server to get access to KronosTime.
// This does not validate whether the server is the oracle.
// This returns an error if the server is not initialized or has
// a stale KronosTime (KronosTime > Time Cap).
KronosTime(ctx context.Context, in *KronosTimeRequest, opts ...grpc.CallOption) (*KronosTimeResponse, error)
// Status returns the status of the server.
Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
}
func NewTimeServiceClient ¶
func NewTimeServiceClient(cc *grpc.ClientConn) TimeServiceClient
type TimeServiceServer ¶
type TimeServiceServer interface {
// OracleTime returns the server's KronosTime if the server believes it is
// the oracle, otherwise it returns an error.
// A distributed state machine is used to store the identity of the oracle
// and it is used by the server to know if it should respond to OracleTime
// requests.
// This RPC is used internally by kronos nodes to sync time with the elected
// oracle.
// This returns an error if
// 1. The server is not the current oracle.
// 2. The server is not initialized.
// 3. The server's KronosTime is stale (KronosTime > Time Cap). This can
// mean that the cluster has lost a quorum of the nodes.
OracleTime(context.Context, *OracleTimeRequest) (*OracleTimeResponse, error)
// KronosTime returns the server's KronosTime. An application can call this
// RPC on the local kronos server to get access to KronosTime.
// This does not validate whether the server is the oracle.
// This returns an error if the server is not initialized or has
// a stale KronosTime (KronosTime > Time Cap).
KronosTime(context.Context, *KronosTimeRequest) (*KronosTimeResponse, error)
// Status returns the status of the server.
Status(context.Context, *StatusRequest) (*StatusResponse, error)
}
type UpdateDriftTimeServiceClient ¶
type UpdateDriftTimeServiceClient interface {
UpdateDriftConfig(ctx context.Context, in *DriftTimeConfig, opts ...grpc.CallOption) (*DriftTimeResponse, error)
}
func NewUpdateDriftTimeServiceClient ¶
func NewUpdateDriftTimeServiceClient(cc *grpc.ClientConn) UpdateDriftTimeServiceClient
type UpdateDriftTimeServiceServer ¶
type UpdateDriftTimeServiceServer interface {
UpdateDriftConfig(context.Context, *DriftTimeConfig) (*DriftTimeResponse, error)
}
Click to show internal directories.
Click to hide internal directories.