server

package
v0.0.0-...-5c72b2d Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	XTenantID  = "X-Tenant-ID"
	XIndexKey  = "X-Index-Key"
	XRequestID = "X-Request-ID"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCGateway

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

func NewGRPCGateway

func NewGRPCGateway(httpAddress string, grpcAddress string, certFile string, keyFile string, commonName string, logger logger.DefaultLogger) (*GRPCGateway, error)

func (*GRPCGateway) Start

func (s *GRPCGateway) Start() error

func (*GRPCGateway) Stop

func (s *GRPCGateway) Stop() error

type GRPCServer

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

func NewGRPCServerWithTLS

func NewGRPCServerWithTLS(grpcAddress string, raftServer *RaftServer, certificateFile string, keyFile string, commonName string, logger logger.LogrusLogger) (*GRPCServer, error)

func NewGrpcServer

func NewGrpcServer(grpcAddress string, raftServer *RaftServer, logger logger.LogrusLogger) (*GRPCServer, error)

func (*GRPCServer) Start

func (s *GRPCServer) Start() error

func (*GRPCServer) Stop

func (s *GRPCServer) Stop() error

type GRPCService

type GRPCService struct {
	*protobuf.UnimplementedDocsearchServer
	// contains filtered or unexported fields
}

func NewGRPCService

func NewGRPCService(opts ...Option) (*GRPCService, error)

func (*GRPCService) BulkDelete

func (s *GRPCService) BulkDelete(ctx context.Context, req *protobuf.DeleteDocuments) (*emptypb.Empty, error)

func (*GRPCService) Cluster

func (s *GRPCService) Cluster(ctx context.Context, req *empty.Empty) (*protobuf.ClusterResponse, error)

func (*GRPCService) Delete

func (*GRPCService) DeleteDictionary

func (*GRPCService) Join

func (*GRPCService) Leave

func (*GRPCService) LivenessCheck

func (*GRPCService) Metrics

func (s *GRPCService) Metrics(ctx context.Context, req *empty.Empty) (*protobuf.MetricsResponse, error)

func (*GRPCService) Node

func (*GRPCService) ReadinessCheck

func (*GRPCService) Search

func (*GRPCService) Start

func (s *GRPCService) Start() error

func (*GRPCService) Stop

func (s *GRPCService) Stop() error

func (*GRPCService) Upload

func (s *GRPCService) Upload(ctx context.Context, req *protobuf.Documents) (*emptypb.Empty, error)

func (*GRPCService) UploadDictionary

func (*GRPCService) Watch

func (s *GRPCService) Watch(req *empty.Empty, server protobuf.Docsearch_WatchServer) error

type Option

type Option func(service *GRPCService)

func WithCertificate

func WithCertificate(certFile, commonName string) Option

func WithLogger

func WithLogger(logger logger.LogrusLogger) Option

func WithRaftServer

func WithRaftServer(raftServer *RaftServer) Option

type RaftServer

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

func NewRaftServer

func NewRaftServer(conf *config.AppConfig, raftAddress string, bootstrap bool, log logger.LogrusLogger) (*RaftServer, error)

func (*RaftServer) AddUserDictionary

AddUserDictionary is ユーザー辞書の追加

func (*RaftServer) BulkDelete

func (s *RaftServer) BulkDelete(req *protobuf.DeleteDocuments) error

BulkDelete is ドキュメントの一括削除

func (*RaftServer) Exist

func (s *RaftServer) Exist(id string) (bool, error)

Exist is ノードが既にクラスター内に存在しているか

func (*RaftServer) Join

func (s *RaftServer) Join(id string, node *protobuf.Node) error

Join is ノードの追加

func (*RaftServer) LeaderAddress

func (s *RaftServer) LeaderAddress(timeout time.Duration) (raft.ServerAddress, error)

LeaderAddress is リーダーアドレスの取得

func (*RaftServer) LeaderID

func (s *RaftServer) LeaderID(timeout time.Duration) (raft.ServerID, error)

LeaderID is リーダーIDの取得

func (*RaftServer) Leave

func (s *RaftServer) Leave(id string) error

Leave is ノードの離脱

func (*RaftServer) Node

func (s *RaftServer) Node() (*protobuf.Node, error)

Node is 問い合わせノードの取得

func (*RaftServer) Nodes

func (s *RaftServer) Nodes() (map[string]*protobuf.Node, error)

Nodes is 全ノードの取得

func (*RaftServer) RemoveDictionary

func (*RaftServer) Search

Search is ドキュメントの検索

func (*RaftServer) Start

func (s *RaftServer) Start() error

Start is raft server の開始

func (*RaftServer) State

func (s *RaftServer) State() raft.RaftState

State is raft serverの状態を取得

func (*RaftServer) StateStr

func (s *RaftServer) StateStr() string

StateStr is raft serverの状態を文字列で取得

func (*RaftServer) Stop

func (s *RaftServer) Stop() error

Stop is raft server の停止

func (*RaftServer) Upload

func (s *RaftServer) Upload(req *protobuf.Documents) error

Upload is ドキュメンの追加・更新

func (*RaftServer) WaitForDetectLeader

func (s *RaftServer) WaitForDetectLeader(timeout time.Duration) error

WaitForDetectLeader is リーダーの検出待ち

Jump to

Keyboard shortcuts

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