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.
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)
}
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.
Click to show internal directories.
Click to hide internal directories.