service

package
v0.0.0-...-0194b68 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package service is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadJson = errors.New("bad json couldn't be parsed properly")
	ErrEmpty   = errors.New("no statements were provided")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	EnablePPROF bool
}

type DBResponse

type DBResponse struct {
	ExecRes  []*pb.ExecRes
	QueryRes []*pb.QueryRes
}

func (*DBResponse) MarshalJSON

func (d *DBResponse) MarshalJSON() ([]byte, error)

type DataResponse

type DataResponse struct {
	Results *DBResponse `json:"results,omitempty"`
	Error   string      `json:"error,omitempty"`
}

type Manager

type Manager interface {
	GetNodeAPIAddr(nodeAddr string) (string, error)
}

type MockStore

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

MockStore is a mock of Store interface.

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance.

func (*MockStore) EXPECT

func (m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStore) Exec

func (m *MockStore) Exec(arg0 *pb.Request) ([]*pb.ExecRes, error)

Exec mocks base method.

func (*MockStore) GetServers

func (m *MockStore) GetServers() ([]*pb.Server, error)

GetServers mocks base method.

func (*MockStore) Join

func (m *MockStore) Join(arg0, arg1 string) error

Join mocks base method.

func (*MockStore) LeaderAddr

func (m *MockStore) LeaderAddr() string

LeaderAddr mocks base method.

func (*MockStore) Leave

func (m *MockStore) Leave(arg0 string) error

Leave mocks base method.

func (*MockStore) Metrics

func (m *MockStore) Metrics() (map[string]interface{}, error)

Metrics mocks base method.

func (*MockStore) Query

func (m *MockStore) Query(arg0 *pb.QueryReq) ([]*pb.QueryRes, error)

Query mocks base method.

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore.

func (*MockStoreMockRecorder) Exec

func (mr *MockStoreMockRecorder) Exec(arg0 interface{}) *gomock.Call

Exec indicates an expected call of Exec.

func (*MockStoreMockRecorder) GetServers

func (mr *MockStoreMockRecorder) GetServers() *gomock.Call

GetServers indicates an expected call of GetServers.

func (*MockStoreMockRecorder) Join

func (mr *MockStoreMockRecorder) Join(arg0, arg1 interface{}) *gomock.Call

Join indicates an expected call of Join.

func (*MockStoreMockRecorder) LeaderAddr

func (mr *MockStoreMockRecorder) LeaderAddr() *gomock.Call

LeaderAddr indicates an expected call of LeaderAddr.

func (*MockStoreMockRecorder) Leave

func (mr *MockStoreMockRecorder) Leave(arg0 interface{}) *gomock.Call

Leave indicates an expected call of Leave.

func (*MockStoreMockRecorder) Metrics

func (mr *MockStoreMockRecorder) Metrics() *gomock.Call

Metrics indicates an expected call of Metrics.

func (*MockStoreMockRecorder) Query

func (mr *MockStoreMockRecorder) Query(arg0 interface{}) *gomock.Call

Query indicates an expected call of Query.

type Service

type Service struct {

	// security
	CAFile   string
	CertFile string
	KeyFile  string
	// contains filtered or unexported fields
}

Service handles the http front to the store.

func NewService

func NewService(addr string, store Store, conf Config) (*Service, error)

func (*Service) Addr

func (s *Service) Addr() net.Addr

func (*Service) Close

func (s *Service) Close() error

func (*Service) GetLeaderAPIAddr

func (s *Service) GetLeaderAPIAddr() string

func (*Service) IsHTTPS

func (s *Service) IsHTTPS() bool

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Service) Start

func (s *Service) Start() error

func (*Service) StartWithListener

func (s *Service) StartWithListener(ln net.Listener) error

type Store

type Store interface {
	Exec(req *pb.Request) ([]*pb.ExecRes, error)
	Query(req *pb.QueryReq) ([]*pb.QueryRes, error)
	LeaderAddr() string
	Join(id, addr string) error
	Leave(id string) error
	GetServers() ([]*pb.Server, error)
	Metrics() (map[string]any, error)
}

Jump to

Keyboard shortcuts

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