index

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DurationSeconds = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Namespace: namespace,
			Subsystem: subsystem,
			Name:      "duration_seconds",
			Help:      "The index operation durations in seconds.",
		},
		[]string{
			"func",
		},
	)
	OperationsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Namespace: namespace,
			Subsystem: subsystem,
			Name:      "operations_total",
			Help:      "The number of index operations.",
		},
		[]string{
			"func",
		},
	)
)

Functions

func RecordMetrics

func RecordMetrics(start time.Time, funcName string)

Types

type DeleteHandler

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

func NewDeleteHandler

func NewDeleteHandler(client *GRPCClient, logger *log.Logger) *DeleteHandler

func (*DeleteHandler) ServeHTTP

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

type GRPCClient

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

func NewGRPCClient

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

func (*GRPCClient) Close

func (c *GRPCClient) Close() error

func (*GRPCClient) Delete

func (c *GRPCClient) Delete(doc *index.Document, opts ...grpc.CallOption) error

func (*GRPCClient) Get

func (c *GRPCClient) Get(doc *index.Document, opts ...grpc.CallOption) (*index.Document, error)

func (*GRPCClient) GetCluster

func (c *GRPCClient) GetCluster(opts ...grpc.CallOption) (*raft.Cluster, error)

func (*GRPCClient) GetNode

func (c *GRPCClient) GetNode(opts ...grpc.CallOption) (*raft.Node, error)

func (*GRPCClient) Index

func (c *GRPCClient) Index(doc *index.Document, opts ...grpc.CallOption) error

func (*GRPCClient) Join

func (c *GRPCClient) Join(node *raft.Node, opts ...grpc.CallOption) error

func (*GRPCClient) Leave

func (c *GRPCClient) Leave(node *raft.Node, opts ...grpc.CallOption) error

func (*GRPCClient) Search

func (c *GRPCClient) Search(searchRequest *bleve.SearchRequest, opts ...grpc.CallOption) (*bleve.SearchResult, error)

func (*GRPCClient) Snapshot

func (c *GRPCClient) Snapshot(opts ...grpc.CallOption) error

type GRPCServer

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

func NewGRPCServer

func NewGRPCServer(grpcAddr string, service *GRPCService, logger *log.Logger) (*GRPCServer, error)

func (*GRPCServer) Start

func (s *GRPCServer) Start() error

func (*GRPCServer) Stop

func (s *GRPCServer) Stop() error

type GRPCService

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

func NewGRPCService

func NewGRPCService(store *RaftServer, logger *log.Logger) (*GRPCService, error)

func (*GRPCService) Delete

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

func (*GRPCService) Get

func (*GRPCService) GetCluster

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

func (*GRPCService) GetNode

func (s *GRPCService) GetNode(ctx context.Context, req *empty.Empty) (*raft.GetNodeResponse, error)

func (*GRPCService) Index

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

func (*GRPCService) Join

func (s *GRPCService) Join(ctx context.Context, req *raft.JoinRequest) (*empty.Empty, error)

func (*GRPCService) Leave

func (s *GRPCService) Leave(ctx context.Context, req *raft.LeaveRequest) (*empty.Empty, error)

func (*GRPCService) Search

func (*GRPCService) Snapshot

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

type GetHandler

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

func NewGetHandler

func NewGetHandler(client *GRPCClient, logger *log.Logger) *GetHandler

func (*GetHandler) ServeHTTP

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

type HTTPServer

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

func NewHTTPServer

func NewHTTPServer(httpAddr string, grpcClient *GRPCClient, logger *log.Logger, httpLogger *log.Logger) (*HTTPServer, error)

func (*HTTPServer) Start

func (s *HTTPServer) Start() error

func (*HTTPServer) Stop

func (s *HTTPServer) Stop() error

type Index

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

func NewIndex

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

func (*Index) Close

func (b *Index) Close() error

func (*Index) Delete

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

func (*Index) Get

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

func (*Index) Index

func (b *Index) Index(id string, fields map[string]interface{}) error

func (*Index) Search

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

func (*Index) SnapshotItems

func (b *Index) SnapshotItems() <-chan *pbindex.Document

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 NewIndexHandler

func NewIndexHandler(client *GRPCClient, logger *log.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, indexMapping *mapping.IndexMappingImpl, logger *log.Logger) (*RaftFSM, error)

func (*RaftFSM) Apply

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

func (*RaftFSM) Close

func (f *RaftFSM) Close() error

func (*RaftFSM) Get

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

func (*RaftFSM) GetMetadata

func (f *RaftFSM) GetMetadata(nodeId string) (*blastraft.Node, 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)

type RaftServer

type RaftServer struct {
	Node *blastraft.Node
	// contains filtered or unexported fields
}

func NewRaftServer

func NewRaftServer(node *blastraft.Node, bootstrap bool, indexMapping *mapping.IndexMappingImpl, logger *log.Logger) (*RaftServer, error)

func (*RaftServer) Delete

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

func (*RaftServer) Get

func (s *RaftServer) Get(doc *index.Document) (*index.Document, error)

func (*RaftServer) GetCluster

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

func (*RaftServer) GetNode

func (s *RaftServer) GetNode() (*blastraft.Node, error)

func (*RaftServer) Index

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

func (*RaftServer) Join

func (s *RaftServer) Join(node *blastraft.Node) error

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

func (s *RaftServer) Leave(node *blastraft.Node) error

func (*RaftServer) Search

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

func (*RaftServer) Snapshot

func (s *RaftServer) Snapshot() error

func (*RaftServer) Start

func (s *RaftServer) Start() error

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 *log.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 *GRPCClient, logger *log.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(nodeId string, bindAddr string, grpcAddr string, httpAddr string, dataDir string, joinAddr string, indexMappingPath string, logger *log.Logger, httpLogger *log.Logger) *Server

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