indexer

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2019 License: Apache-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCContext added in v0.8.0

func NewGRPCContext() (context.Context, context.CancelFunc)

Types

type GRPCClient added in v0.8.0

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

func NewGRPCClient added in v0.8.0

func NewGRPCClient(address string) (*GRPCClient, error)

func (*GRPCClient) BulkDelete added in v0.8.0

func (*GRPCClient) BulkIndex added in v0.8.0

func (c *GRPCClient) BulkIndex(req *index.BulkIndexRequest, opts ...grpc.CallOption) (*index.BulkIndexResponse, error)

func (*GRPCClient) Cancel added in v0.8.0

func (c *GRPCClient) Cancel()

func (*GRPCClient) Close added in v0.8.0

func (c *GRPCClient) Close() error

func (*GRPCClient) ClusterInfo added in v0.8.0

func (c *GRPCClient) ClusterInfo(req *empty.Empty, opts ...grpc.CallOption) (*index.ClusterInfoResponse, error)

func (*GRPCClient) ClusterJoin added in v0.8.0

func (c *GRPCClient) ClusterJoin(req *index.ClusterJoinRequest, opts ...grpc.CallOption) (*empty.Empty, error)

func (*GRPCClient) ClusterLeave added in v0.8.0

func (c *GRPCClient) ClusterLeave(req *index.ClusterLeaveRequest, opts ...grpc.CallOption) (*empty.Empty, error)

func (*GRPCClient) ClusterWatch added in v0.8.0

func (c *GRPCClient) ClusterWatch(req *empty.Empty, opts ...grpc.CallOption) (index.Index_ClusterWatchClient, error)

func (*GRPCClient) Delete added in v0.8.0

func (c *GRPCClient) Delete(req *index.DeleteRequest, opts ...grpc.CallOption) (*empty.Empty, error)

func (*GRPCClient) Get added in v0.8.0

func (c *GRPCClient) Get(req *index.GetRequest, opts ...grpc.CallOption) (*index.GetResponse, error)

func (*GRPCClient) GetAddress added in v0.8.0

func (c *GRPCClient) GetAddress() string

func (*GRPCClient) GetIndexConfig added in v0.8.0

func (c *GRPCClient) GetIndexConfig(req *empty.Empty, opts ...grpc.CallOption) (*index.GetIndexConfigResponse, error)

func (*GRPCClient) GetIndexStats added in v0.8.0

func (c *GRPCClient) GetIndexStats(req *empty.Empty, opts ...grpc.CallOption) (*index.GetIndexStatsResponse, error)

func (*GRPCClient) Index added in v0.8.0

func (c *GRPCClient) Index(req *index.IndexRequest, opts ...grpc.CallOption) (*empty.Empty, error)

func (*GRPCClient) NodeHealthCheck added in v0.8.0

func (*GRPCClient) NodeInfo added in v0.8.0

func (c *GRPCClient) NodeInfo(req *empty.Empty, opts ...grpc.CallOption) (*index.NodeInfoResponse, error)

func (*GRPCClient) Search added in v0.8.0

func (c *GRPCClient) Search(req *index.SearchRequest, opts ...grpc.CallOption) (*index.SearchResponse, error)

func (*GRPCClient) Snapshot added in v0.8.0

func (c *GRPCClient) Snapshot(req *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)

type GRPCGateway added in v0.8.0

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

func NewGRPCGateway added in v0.8.0

func NewGRPCGateway(grpcGatewayAddr string, grpcAddr string, logger *zap.Logger) (*GRPCGateway, error)

func (*GRPCGateway) GetAddress added in v0.8.0

func (s *GRPCGateway) GetAddress() (string, error)

func (*GRPCGateway) Start added in v0.8.0

func (s *GRPCGateway) Start() error

func (*GRPCGateway) Stop added in v0.8.0

func (s *GRPCGateway) Stop() error

type GRPCServer added in v0.8.0

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

func NewGRPCServer added in v0.8.0

func NewGRPCServer(grpcAddr string, service index.IndexServer, logger *zap.Logger) (*GRPCServer, error)

func (*GRPCServer) Start added in v0.8.0

func (s *GRPCServer) Start() error

func (*GRPCServer) Stop added in v0.8.0

func (s *GRPCServer) Stop() error

type GRPCService

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

func NewGRPCService

func NewGRPCService(managerGrpcAddress string, shardId string, raftServer *RaftServer, logger *zap.Logger) (*GRPCService, error)

func (*GRPCService) BulkDelete added in v0.8.0

func (*GRPCService) BulkIndex added in v0.8.0

func (*GRPCService) ClusterInfo added in v0.8.0

func (s *GRPCService) ClusterInfo(ctx context.Context, req *empty.Empty) (*index.ClusterInfoResponse, error)

func (*GRPCService) ClusterJoin added in v0.8.0

func (s *GRPCService) ClusterJoin(ctx context.Context, req *index.ClusterJoinRequest) (*empty.Empty, error)

func (*GRPCService) ClusterLeave added in v0.8.0

func (s *GRPCService) ClusterLeave(ctx context.Context, req *index.ClusterLeaveRequest) (*empty.Empty, error)

func (*GRPCService) ClusterWatch added in v0.8.0

func (s *GRPCService) ClusterWatch(req *empty.Empty, server index.Index_ClusterWatchServer) error

func (*GRPCService) Delete added in v0.8.0

func (s *GRPCService) Delete(ctx context.Context, req *index.DeleteRequest) (*empty.Empty, error)

func (*GRPCService) Get added in v0.8.0

func (*GRPCService) GetIndexConfig

func (s *GRPCService) GetIndexConfig(ctx context.Context, req *empty.Empty) (*index.GetIndexConfigResponse, error)

func (*GRPCService) GetIndexStats

func (s *GRPCService) GetIndexStats(ctx context.Context, req *empty.Empty) (*index.GetIndexStatsResponse, error)

func (*GRPCService) Index added in v0.8.0

func (s *GRPCService) Index(ctx context.Context, req *index.IndexRequest) (*empty.Empty, error)

func (*GRPCService) NodeHealthCheck added in v0.8.0

func (*GRPCService) NodeID added in v0.7.1

func (s *GRPCService) NodeID() string

func (*GRPCService) NodeInfo added in v0.8.0

func (s *GRPCService) NodeInfo(ctx context.Context, req *empty.Empty) (*index.NodeInfoResponse, error)

func (*GRPCService) Search

func (*GRPCService) Snapshot

func (s *GRPCService) Snapshot(ctx context.Context, req *empty.Empty) (*empty.Empty, error)

func (*GRPCService) Start

func (s *GRPCService) Start() error

func (*GRPCService) Stop

func (s *GRPCService) Stop() error

type HTTPServer added in v0.8.0

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

func NewHTTPServer added in v0.8.0

func NewHTTPServer(httpAddr string, router *Router, logger *zap.Logger, httpLogger accesslog.Logger) (*HTTPServer, error)

func (*HTTPServer) Start added in v0.8.0

func (s *HTTPServer) Start() error

func (*HTTPServer) Stop added in v0.8.0

func (s *HTTPServer) Stop() error

type Index

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

func NewIndex

func NewIndex(dir string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, logger *zap.Logger) (*Index, error)

func (*Index) BulkDelete added in v0.7.1

func (i *Index) BulkDelete(ids []string) (int, error)

func (*Index) BulkIndex added in v0.7.1

func (i *Index) BulkIndex(docs []*index.Document) (int, error)

func (*Index) Close

func (i *Index) Close() error

func (*Index) Config

func (i *Index) Config() (map[string]interface{}, error)

func (*Index) Delete

func (i *Index) Delete(id string) error

func (*Index) Get

func (i *Index) Get(id string) (map[string]interface{}, error)

func (*Index) Index

func (i *Index) Index(doc *index.Document) error

func (*Index) Search

func (i *Index) Search(request *bleve.SearchRequest) (*bleve.SearchResult, error)

func (*Index) SnapshotItems

func (i *Index) SnapshotItems() <-chan *index.Document

func (*Index) Stats

func (i *Index) Stats() (map[string]interface{}, error)

type JsonMarshaler added in v0.8.0

type JsonMarshaler struct{}

func (*JsonMarshaler) ContentType added in v0.8.0

func (*JsonMarshaler) ContentType() string

ContentType always Returns "application/json".

func (*JsonMarshaler) Delimiter added in v0.8.0

func (j *JsonMarshaler) Delimiter() []byte

Delimiter for newline encoded JSON streams.

func (*JsonMarshaler) Marshal added in v0.8.0

func (j *JsonMarshaler) Marshal(v interface{}) ([]byte, error)

Marshal marshals "v" into JSON

func (*JsonMarshaler) NewDecoder added in v0.8.0

func (j *JsonMarshaler) NewDecoder(r io.Reader) runtime.Decoder

NewDecoder returns a Decoder which reads JSON stream from "r".

func (*JsonMarshaler) NewEncoder added in v0.8.0

func (j *JsonMarshaler) NewEncoder(w io.Writer) runtime.Encoder

NewEncoder returns an Encoder which writes JSON stream into "w".

func (*JsonMarshaler) Unmarshal added in v0.8.0

func (j *JsonMarshaler) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals JSON data into "v".

type JsonlMarshaler added in v0.8.0

type JsonlMarshaler struct{}

func (*JsonlMarshaler) ContentType added in v0.8.0

func (*JsonlMarshaler) ContentType() string

ContentType always Returns "application/json".

func (*JsonlMarshaler) Delimiter added in v0.8.0

func (j *JsonlMarshaler) Delimiter() []byte

Delimiter for newline encoded JSON streams.

func (*JsonlMarshaler) Marshal added in v0.8.0

func (j *JsonlMarshaler) Marshal(v interface{}) ([]byte, error)

Marshal marshals "v" into JSON

func (*JsonlMarshaler) NewDecoder added in v0.8.0

func (j *JsonlMarshaler) NewDecoder(r io.Reader) runtime.Decoder

NewDecoder returns a Decoder which reads JSON-LINE stream from "r".

func (*JsonlMarshaler) NewEncoder added in v0.8.0

func (j *JsonlMarshaler) NewEncoder(w io.Writer) runtime.Encoder

NewEncoder returns an Encoder which writes JSON stream into "w".

func (*JsonlMarshaler) Unmarshal added in v0.8.0

func (j *JsonlMarshaler) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals JSON data into "v".

type RaftFSM

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

func NewRaftFSM

func NewRaftFSM(path string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, logger *zap.Logger) (*RaftFSM, error)

func (*RaftFSM) Apply

func (f *RaftFSM) Apply(l *raft.Log) interface{}

func (*RaftFSM) BulkDelete added in v0.8.0

func (f *RaftFSM) BulkDelete(ids []string) (int, error)

func (*RaftFSM) BulkIndex added in v0.8.0

func (f *RaftFSM) BulkIndex(docs []*index.Document) (int, error)

func (*RaftFSM) Delete added in v0.8.0

func (f *RaftFSM) Delete(id string) error

func (*RaftFSM) DeleteNode added in v0.8.0

func (f *RaftFSM) DeleteNode(nodeId string) error

func (*RaftFSM) GetDocument

func (f *RaftFSM) GetDocument(id string) (map[string]interface{}, error)

func (*RaftFSM) GetIndexConfig

func (f *RaftFSM) GetIndexConfig() (map[string]interface{}, error)

func (*RaftFSM) GetIndexStats

func (f *RaftFSM) GetIndexStats() (map[string]interface{}, error)

func (*RaftFSM) GetNode added in v0.8.0

func (f *RaftFSM) GetNode(nodeId string) (*index.Node, error)

func (*RaftFSM) Index added in v0.8.0

func (f *RaftFSM) Index(doc *index.Document) error

func (*RaftFSM) Restore

func (f *RaftFSM) Restore(rc io.ReadCloser) error

func (*RaftFSM) Search

func (f *RaftFSM) Search(request *bleve.SearchRequest) (*bleve.SearchResult, error)

func (*RaftFSM) SetNode added in v0.8.0

func (f *RaftFSM) SetNode(node *index.Node) error

func (*RaftFSM) Snapshot

func (f *RaftFSM) Snapshot() (raft.FSMSnapshot, error)

func (*RaftFSM) Start

func (f *RaftFSM) Start() error

func (*RaftFSM) Stop

func (f *RaftFSM) Stop() error

type RaftFSMSnapshot added in v0.7.1

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

func (*RaftFSMSnapshot) Persist added in v0.7.1

func (f *RaftFSMSnapshot) Persist(sink raft.SnapshotSink) error

func (*RaftFSMSnapshot) Release added in v0.7.1

func (f *RaftFSMSnapshot) Release()

type RaftServer

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

func NewRaftServer

func NewRaftServer(node *index.Node, dataDir string, raftStorageType string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, bootstrap bool, logger *zap.Logger) (*RaftServer, error)

func (*RaftServer) BulkDelete added in v0.8.0

func (s *RaftServer) BulkDelete(ids []string) (int, error)

func (*RaftServer) BulkIndex added in v0.8.0

func (s *RaftServer) BulkIndex(docs []*index.Document) (int, error)

func (*RaftServer) Delete added in v0.8.0

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

func (*RaftServer) DeleteNode added in v0.7.1

func (s *RaftServer) DeleteNode(nodeId string) error

func (*RaftServer) Get added in v0.8.0

func (s *RaftServer) Get(id string) (map[string]interface{}, error)

func (*RaftServer) GetCluster added in v0.7.1

func (s *RaftServer) GetCluster() (*index.Cluster, error)

func (*RaftServer) GetIndexConfig

func (s *RaftServer) GetIndexConfig() (map[string]interface{}, error)

func (*RaftServer) GetIndexStats

func (s *RaftServer) GetIndexStats() (map[string]interface{}, error)

func (*RaftServer) GetNode added in v0.7.1

func (s *RaftServer) GetNode(id string) (*index.Node, error)

func (*RaftServer) Index added in v0.8.0

func (s *RaftServer) Index(doc *index.Document) error

func (*RaftServer) IsLeader

func (s *RaftServer) IsLeader() bool

func (*RaftServer) LeaderAddress

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

func (*RaftServer) LeaderID

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

func (*RaftServer) NodeAddress added in v0.8.0

func (s *RaftServer) NodeAddress() string

func (*RaftServer) NodeID added in v0.7.1

func (s *RaftServer) NodeID() string

func (*RaftServer) Search

func (s *RaftServer) Search(request *bleve.SearchRequest) (*bleve.SearchResult, error)

func (*RaftServer) SetNode added in v0.7.1

func (s *RaftServer) SetNode(node *index.Node) error

func (*RaftServer) Snapshot

func (s *RaftServer) Snapshot() error

func (*RaftServer) Start

func (s *RaftServer) Start() error

func (*RaftServer) State

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

func (*RaftServer) Stats

func (s *RaftServer) Stats() map[string]string

func (*RaftServer) Stop

func (s *RaftServer) Stop() error

func (*RaftServer) WaitForDetectLeader

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

type RootHandler

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

func NewRootHandler

func NewRootHandler(logger *zap.Logger) *RootHandler

func (*RootHandler) ServeHTTP

func (h *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Router added in v0.8.0

type Router struct {
	mux.Router
	// contains filtered or unexported fields
}

func NewRouter

func NewRouter(logger *zap.Logger) (*Router, error)

func (*Router) Close added in v0.8.0

func (r *Router) Close() error

type Server

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

func NewServer

func NewServer(managerGrpcAddress string, shardId string, peerGrpcAddress string, node *index.Node, dataDir string, raftStorageType string, indexMapping *mapping.IndexMappingImpl, indexType string, indexStorageType string, logger *zap.Logger, grpcLogger *zap.Logger, httpLogger accesslog.Logger) (*Server, error)

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

type TextMarshaler added in v0.8.0

type TextMarshaler struct{}

func (*TextMarshaler) ContentType added in v0.8.0

func (*TextMarshaler) ContentType() string

ContentType always Returns "application/json".

func (*TextMarshaler) Delimiter added in v0.8.0

func (j *TextMarshaler) Delimiter() []byte

Delimiter for newline encoded JSON streams.

func (*TextMarshaler) Marshal added in v0.8.0

func (j *TextMarshaler) Marshal(v interface{}) ([]byte, error)

Marshal marshals "v" into JSON

func (*TextMarshaler) NewDecoder added in v0.8.0

func (j *TextMarshaler) NewDecoder(r io.Reader) runtime.Decoder

NewDecoder returns a Decoder which reads text stream from "r".

func (*TextMarshaler) NewEncoder added in v0.8.0

func (j *TextMarshaler) NewEncoder(w io.Writer) runtime.Encoder

NewEncoder returns an Encoder which writes JSON stream into "w".

func (*TextMarshaler) Unmarshal added in v0.8.0

func (j *TextMarshaler) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals JSON data into "v".

Jump to

Keyboard shortcuts

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