zsource

package
v0.0.0-...-031d970 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SourceCode_name = map[int32]string{
		0: "SOURCE_SUCCESS",
		1: "SOURCE_LOCK",
		2: "SOURCE_ERROR",
	}
	SourceCode_value = map[string]int32{
		"SOURCE_SUCCESS": 0,
		"SOURCE_LOCK":    1,
		"SOURCE_ERROR":   2,
	}
)

Enum value maps for SourceCode.

View Source
var (
	ReBalanceCode_name = map[int32]string{
		0: "REBALANCE_SUCCESS",
		1: "REBALANCE_LOCK",
		2: "REBALANCE_ERROR",
	}
	ReBalanceCode_value = map[string]int32{
		"REBALANCE_SUCCESS": 0,
		"REBALANCE_LOCK":    1,
		"REBALANCE_ERROR":   2,
	}
)

Enum value maps for ReBalanceCode.

View Source
var File_source_proto protoreflect.FileDescriptor

Functions

func RegisterSourceServer

func RegisterSourceServer(s *grpc.Server, srv SourceServer)

Types

type ReBalanceCode

type ReBalanceCode int32
const (
	ReBalanceCode_REBALANCE_SUCCESS ReBalanceCode = 0
	ReBalanceCode_REBALANCE_LOCK    ReBalanceCode = 1
	ReBalanceCode_REBALANCE_ERROR   ReBalanceCode = 2
)

func (ReBalanceCode) Descriptor

func (ReBalanceCode) Enum

func (x ReBalanceCode) Enum() *ReBalanceCode

func (ReBalanceCode) EnumDescriptor deprecated

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

Deprecated: Use ReBalanceCode.Descriptor instead.

func (ReBalanceCode) Number

func (ReBalanceCode) String

func (x ReBalanceCode) String() string

func (ReBalanceCode) Type

type ReBalanceReply

type ReBalanceReply struct {
	Code  ReBalanceCode `protobuf:"varint,1,opt,name=Code,proto3,enum=source.ReBalanceCode" json:"Code,omitempty"`
	Begin uint32        `protobuf:"varint,2,opt,name=Begin,proto3" json:"Begin,omitempty"`
	End   uint32        `protobuf:"varint,3,opt,name=End,proto3" json:"End,omitempty"`
	Name  string        `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"`
	// contains filtered or unexported fields
}

func (*ReBalanceReply) Descriptor deprecated

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

Deprecated: Use ReBalanceReply.ProtoReflect.Descriptor instead.

func (*ReBalanceReply) GetBegin

func (x *ReBalanceReply) GetBegin() uint32

func (*ReBalanceReply) GetCode

func (x *ReBalanceReply) GetCode() ReBalanceCode

func (*ReBalanceReply) GetEnd

func (x *ReBalanceReply) GetEnd() uint32

func (*ReBalanceReply) GetName

func (x *ReBalanceReply) GetName() string

func (*ReBalanceReply) ProtoMessage

func (*ReBalanceReply) ProtoMessage()

func (*ReBalanceReply) ProtoReflect

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

func (*ReBalanceReply) Reset

func (x *ReBalanceReply) Reset()

func (*ReBalanceReply) String

func (x *ReBalanceReply) String() string

type ReBalanceRequest

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

func (*ReBalanceRequest) Descriptor deprecated

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

Deprecated: Use ReBalanceRequest.ProtoReflect.Descriptor instead.

func (*ReBalanceRequest) ProtoMessage

func (*ReBalanceRequest) ProtoMessage()

func (*ReBalanceRequest) ProtoReflect

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

func (*ReBalanceRequest) Reset

func (x *ReBalanceRequest) Reset()

func (*ReBalanceRequest) String

func (x *ReBalanceRequest) String() string

type Server

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

Server in source can support service address

func NewServer

func NewServer(ctx context.Context, algo zroute.Algo, config *ServerConfig, sc *zslot.SlotCluster) Server

NewServer is a help function for new Server

func (*Server) ReBalance

func (s *Server) ReBalance(ctx context.Context, in *ReBalanceRequest) (*ReBalanceReply, error)

Source return service addr by key

func (*Server) Source

func (s *Server) Source(ctx context.Context, in *SourceRequest) (*SourceReply, error)

Source return service addr by key

func (*Server) Start

func (s *Server) Start(sourcePort string, conn *zk.Conn, slotBegin uint32, slotEnd uint32, wg *sync.WaitGroup) error

Start server

type ServerConfig

type ServerConfig struct {
	Locked bool // TODO in level 1 we ignore
}

ServerConfig stores config sync from zookeeper

func NewServerConfig

func NewServerConfig() ServerConfig

NewServerConfig is return default ServerConfig

type SourceClient

type SourceClient interface {
	Source(ctx context.Context, in *SourceRequest, opts ...grpc.CallOption) (*SourceReply, error)
	ReBalance(ctx context.Context, in *ReBalanceRequest, opts ...grpc.CallOption) (*ReBalanceReply, error)
}

SourceClient is the client API for Source service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewSourceClient

func NewSourceClient(cc grpc.ClientConnInterface) SourceClient

type SourceCode

type SourceCode int32
const (
	SourceCode_SOURCE_SUCCESS SourceCode = 0
	SourceCode_SOURCE_LOCK    SourceCode = 1
	SourceCode_SOURCE_ERROR   SourceCode = 2
)

func (SourceCode) Descriptor

func (SourceCode) Descriptor() protoreflect.EnumDescriptor

func (SourceCode) Enum

func (x SourceCode) Enum() *SourceCode

func (SourceCode) EnumDescriptor deprecated

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

Deprecated: Use SourceCode.Descriptor instead.

func (SourceCode) Number

func (x SourceCode) Number() protoreflect.EnumNumber

func (SourceCode) String

func (x SourceCode) String() string

func (SourceCode) Type

type SourceReply

type SourceReply struct {
	Code SourceCode `protobuf:"varint,1,opt,name=Code,proto3,enum=source.SourceCode" json:"Code,omitempty"`
	Addr string     `protobuf:"bytes,2,opt,name=Addr,proto3" json:"Addr,omitempty"`
	// contains filtered or unexported fields
}

func (*SourceReply) Descriptor deprecated

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

Deprecated: Use SourceReply.ProtoReflect.Descriptor instead.

func (*SourceReply) GetAddr

func (x *SourceReply) GetAddr() string

func (*SourceReply) GetCode

func (x *SourceReply) GetCode() SourceCode

func (*SourceReply) ProtoMessage

func (*SourceReply) ProtoMessage()

func (*SourceReply) ProtoReflect

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

func (*SourceReply) Reset

func (x *SourceReply) Reset()

func (*SourceReply) String

func (x *SourceReply) String() string

type SourceRequest

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

func (*SourceRequest) Descriptor deprecated

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

Deprecated: Use SourceRequest.ProtoReflect.Descriptor instead.

func (*SourceRequest) GetAction

func (x *SourceRequest) GetAction() string

func (*SourceRequest) GetKey

func (x *SourceRequest) GetKey() string

func (*SourceRequest) ProtoMessage

func (*SourceRequest) ProtoMessage()

func (*SourceRequest) ProtoReflect

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

func (*SourceRequest) Reset

func (x *SourceRequest) Reset()

func (*SourceRequest) String

func (x *SourceRequest) String() string

type SourceServer

type SourceServer interface {
	Source(context.Context, *SourceRequest) (*SourceReply, error)
	ReBalance(context.Context, *ReBalanceRequest) (*ReBalanceReply, error)
}

SourceServer is the server API for Source service.

type UnimplementedSourceServer

type UnimplementedSourceServer struct {
}

UnimplementedSourceServer can be embedded to have forward compatible implementations.

func (*UnimplementedSourceServer) ReBalance

func (*UnimplementedSourceServer) Source

Jump to

Keyboard shortcuts

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