queryservice

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Address is the address of query service.
	Address address.Address `toml:"address"`
}

Config is the query service config.

func (*Config) Adjust

func (c *Config) Adjust(machineHost, defaultListenAddress string)

Adjust adjust config, setup default configs

type QueryService

type QueryService interface {
	// SendMessage send message to a query service.
	SendMessage(ctx context.Context, address string, req *pb.Request) (*pb.Response, error)
	// NewRequest creates a new request by cmd method.
	NewRequest(pb.CmdMethod) *pb.Request
	// Release releases the response.
	Release(*pb.Response)
	// Start starts the service.
	Start() error
	// Close closes the service.
	Close() error
	// AddHandleFunc add message handler.
	AddHandleFunc(method pb.CmdMethod, h func(context.Context, *pb.Request, *pb.Response) error, async bool)
	// ServiceID return the uuid of current CN service
	ServiceID() string
}

QueryService is used to send query request to another CN service.

func NewQueryService

func NewQueryService(serviceID string, address string, cfg morpc.Config, sm *SessionManager) (QueryService, error)

NewQueryService creates a new queryService instance.

type Session

type Session interface {
	// GetUUIDString returns the id of the session.
	GetUUIDString() string
	// GetTenantName returns the tenant name of the session.
	GetTenantName() string
	// StatusSession converts the session to status.Session.
	StatusSession() *status.Session
	// SetSessionRoutineStatus set the session Status
	SetSessionRoutineStatus(status string) error
}

Session is an interface which should have the following methods.

type SessionManager

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

SessionManager manages all sessions locally.

func NewSessionManager

func NewSessionManager() *SessionManager

NewSessionManager creates a new SessionManager instance.

func (*SessionManager) AddSession

func (sm *SessionManager) AddSession(s Session)

AddSession adds a new session to manager.

func (*SessionManager) GetAllSessions

func (sm *SessionManager) GetAllSessions() []Session

GetAllSessions returns all sessions in the manager.

func (*SessionManager) GetSessionsByTenant

func (sm *SessionManager) GetSessionsByTenant(tenant string) []Session

GetSessionsByTenant returns the sessions belongs to the tenant.

func (*SessionManager) RemoveSession

func (sm *SessionManager) RemoveSession(s Session)

RemoveSession removes a session from manager.

Jump to

Keyboard shortcuts

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