kronospb

package
v0.0.0-...-2c42c2a Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: MIT Imports: 8 Imported by: 0

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

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) Descriptor() ([]byte, []int)

func (*Cluster) Marshal

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

func (*Cluster) MarshalTo

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

func (*Cluster) ProtoMessage

func (*Cluster) ProtoMessage()

func (*Cluster) Reset

func (m *Cluster) Reset()

func (*Cluster) Size

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

func (*Cluster) String

func (m *Cluster) String() string

func (*Cluster) Unmarshal

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

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) MarshalTo

func (m *DriftTimeConfig) MarshalTo(dAtA []byte) (int, 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) Descriptor() ([]byte, []int)

func (*Node) Marshal

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

func (*Node) MarshalTo

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

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) Reset

func (m *Node) Reset()

func (*Node) Size

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

func (*Node) String

func (m *Node) String() string

func (*Node) Unmarshal

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

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) Descriptor() ([]byte, []int)

func (*NodeAddr) Marshal

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

func (*NodeAddr) MarshalTo

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

func (*NodeAddr) ProtoMessage

func (*NodeAddr) ProtoMessage()

func (*NodeAddr) Reset

func (m *NodeAddr) Reset()

func (*NodeAddr) Size

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

func (*NodeAddr) String

func (m *NodeAddr) String() string

func (*NodeAddr) Unmarshal

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

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) MarshalTo

func (m *OracleProposal) MarshalTo(dAtA []byte) (int, 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) MarshalTo

func (m *OracleState) MarshalTo(dAtA []byte) (int, 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) MarshalTo

func (m *StatusRequest) MarshalTo(dAtA []byte) (int, 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) MarshalTo

func (m *StatusResponse) MarshalTo(dAtA []byte) (int, 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)
}

Jump to

Keyboard shortcuts

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