indexer

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

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

Types

type DeleteHandler

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

func NewDeleteDocumentHandler

func NewDeleteDocumentHandler(client *grpc.Client, logger *zap.Logger) *DeleteHandler

func (*DeleteHandler) ServeHTTP

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

type GRPCService

type GRPCService struct {
	*grpc.Service
	// contains filtered or unexported fields
}

func NewGRPCService

func NewGRPCService(managerAddr string, clusterId string, raftServer *RaftServer, logger *zap.Logger) (*GRPCService, error)

func (*GRPCService) DeleteDocument

func (s *GRPCService) DeleteDocument(stream protobuf.Blast_DeleteDocumentServer) error

func (*GRPCService) DeleteNode

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

func (*GRPCService) GetCluster

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

func (*GRPCService) GetDocument

func (*GRPCService) GetIndexConfig

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

func (*GRPCService) GetIndexStats

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

func (*GRPCService) GetNode

func (*GRPCService) IndexDocument

func (s *GRPCService) IndexDocument(stream protobuf.Blast_IndexDocumentServer) error

func (*GRPCService) Search

func (*GRPCService) SetNode

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

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

func (*GRPCService) WatchCluster

func (s *GRPCService) WatchCluster(req *empty.Empty, server protobuf.Blast_WatchClusterServer) error

type GetHandler

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

func NewGetDocumentHandler

func NewGetDocumentHandler(client *grpc.Client, logger *zap.Logger) *GetHandler

func (*GetHandler) ServeHTTP

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

type Index

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

func NewIndex

func NewIndex(dir string, indexConfig map[string]interface{}, logger *zap.Logger) (*Index, 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(id string, fields map[string]interface{}) error

func (*Index) Search

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

func (*Index) SnapshotItems

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

func (*Index) Stats

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

type IndexFSMSnapshot

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

func (*IndexFSMSnapshot) Persist

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

func (*IndexFSMSnapshot) Release

func (f *IndexFSMSnapshot) Release()

type IndexHandler

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

func NewSetDocumentHandler

func NewSetDocumentHandler(client *grpc.Client, logger *zap.Logger) *IndexHandler

func (*IndexHandler) ServeHTTP

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

type RaftFSM

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

func NewRaftFSM

func NewRaftFSM(path string, indexConfig map[string]interface{}, logger *zap.Logger) (*RaftFSM, error)

func (*RaftFSM) Apply

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

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

func (f *RaftFSM) GetMetadata(id string) (map[string]interface{}, 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) 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 RaftServer

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

func NewRaftServer

func NewRaftServer(id string, metadata map[string]interface{}, bootstrap bool, indexConfig map[string]interface{}, logger *zap.Logger) (*RaftServer, error)

func (*RaftServer) DeleteDocument

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

func (*RaftServer) DeleteMetadata

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

func (*RaftServer) GetDocument

func (s *RaftServer) GetDocument(id string) (map[string]interface{}, 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) GetMetadata

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

func (*RaftServer) GetServers

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

func (*RaftServer) IndexDocument

func (s *RaftServer) IndexDocument(docs []map[string]interface{}) (int, 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) Search

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

func (*RaftServer) SetMetadata

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

func (*RaftServer) Snapshot

func (s *RaftServer) Snapshot() error

func (*RaftServer) Start

func (s *RaftServer) Start() error

func (*RaftServer) State

func (s *RaftServer) State() string

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 SearchHandler

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

func NewSearchHandler

func NewSearchHandler(client *grpc.Client, logger *zap.Logger) *SearchHandler

func (*SearchHandler) ServeHTTP

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

type Server

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

func NewServer

func NewServer(managerAddr string, clusterId string, id string, metadata map[string]interface{}, peerAddr string, indexConfig map[string]interface{}, logger *zap.Logger, httpLogger accesslog.Logger) (*Server, error)

func (*Server) Start

func (s *Server) Start()

func (*Server) Stop

func (s *Server) Stop()

Jump to

Keyboard shortcuts

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