Documentation ¶
Index ¶
- type Database
- type DbInstance
- func (a *DbInstance) CreateDb(vo *api.CreateDbRequest) error
- func (a *DbInstance) GetDb(name string) *Database
- func (a *DbInstance) MigrateOut(request *api.MigrateOutDbRequest, callback func() error) error
- func (a *DbInstance) MustGetDb(name string) *Database
- func (a *DbInstance) Send(job *proto.DbJob)
- func (a *DbInstance) ServeDbJob(s proto.DbJobSvc_RegisterServer)
- func (a *DbInstance) StatusResponse() *api.InstanceStatusResponse
- func (a *DbInstance) UpdateDatabase(db *proto.Database)
- func (a *DbInstance) UpdateDatabases(databases []*proto.Database)
- type DbInstanceManager
- func (m *DbInstanceManager) CreateDb(request *api.CreateDbRequest) error
- func (m *DbInstanceManager) FilterInstances(filter *api.InstanceFilter) []*DbInstance
- func (m *DbInstanceManager) FirstMatchedInstance(filter *api.InstanceFilter) *DbInstance
- func (m *DbInstanceManager) GetDb(vo *api.DbRequest) (*proto.Database, error)
- func (m *DbInstanceManager) GetDbStatus(request *api.DbRequest) (*api.DbStatusResponse, error)
- func (m *DbInstanceManager) GetInstance(instName string) *DbInstance
- func (m *DbInstanceManager) NewInstance(instName string, pgVersion int32, logger *zerolog.Logger) (*DbInstance, error)
- func (m *DbInstanceManager) SubscribeDbStatus(callback api.SubscribeDbStatusFunc)
- func (m *DbInstanceManager) SubscribeInstanceStatus(callback api.SubscribeInstanceStatusFunc)
- func (m *DbInstanceManager) WaitReady(instName, dbName string, timeout time.Duration) bool
- type DbJobSvcHandler
- type DbStatusSubscriber
- type GrpcServer
- type InstanceStatusSubscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
func NewDatabase ¶
func NewDatabase() *Database
func (*Database) StatusResponse ¶
func (d *Database) StatusResponse() *api.DbStatusResponse
type DbInstance ¶
type DbInstance struct { Name string PgVersion int32 Online bool Databases map[string]*Database DbJobChan chan *proto.DbJob // contains filtered or unexported fields }
func NewDbInstance ¶
func NewDbInstance(name string, pgVersion int32, logger *zerolog.Logger, subcriber *DbStatusSubscriber) *DbInstance
func (*DbInstance) CreateDb ¶
func (a *DbInstance) CreateDb(vo *api.CreateDbRequest) error
func (*DbInstance) GetDb ¶
func (a *DbInstance) GetDb(name string) *Database
func (*DbInstance) MigrateOut ¶
func (a *DbInstance) MigrateOut(request *api.MigrateOutDbRequest, callback func() error) error
Return true if send the migrateOut job
func (*DbInstance) MustGetDb ¶
func (a *DbInstance) MustGetDb(name string) *Database
func (*DbInstance) Send ¶
func (a *DbInstance) Send(job *proto.DbJob)
func (*DbInstance) ServeDbJob ¶
func (a *DbInstance) ServeDbJob(s proto.DbJobSvc_RegisterServer)
func (*DbInstance) StatusResponse ¶
func (a *DbInstance) StatusResponse() *api.InstanceStatusResponse
func (*DbInstance) UpdateDatabase ¶
func (a *DbInstance) UpdateDatabase(db *proto.Database)
func (*DbInstance) UpdateDatabases ¶
func (a *DbInstance) UpdateDatabases(databases []*proto.Database)
type DbInstanceManager ¶
type DbInstanceManager struct { Instances map[string]*DbInstance InstSubscriber *InstanceStatusSubscriber // contains filtered or unexported fields }
func NewDbInstanceManager ¶
func NewDbInstanceManager() *DbInstanceManager
func (*DbInstanceManager) CreateDb ¶
func (m *DbInstanceManager) CreateDb(request *api.CreateDbRequest) error
func (*DbInstanceManager) FilterInstances ¶
func (m *DbInstanceManager) FilterInstances(filter *api.InstanceFilter) []*DbInstance
func (*DbInstanceManager) FirstMatchedInstance ¶
func (m *DbInstanceManager) FirstMatchedInstance(filter *api.InstanceFilter) *DbInstance
func (*DbInstanceManager) GetDbStatus ¶
func (m *DbInstanceManager) GetDbStatus(request *api.DbRequest) (*api.DbStatusResponse, error)
func (*DbInstanceManager) GetInstance ¶
func (m *DbInstanceManager) GetInstance(instName string) *DbInstance
func (*DbInstanceManager) NewInstance ¶
func (m *DbInstanceManager) NewInstance(instName string, pgVersion int32, logger *zerolog.Logger) (*DbInstance, error)
func (*DbInstanceManager) SubscribeDbStatus ¶
func (m *DbInstanceManager) SubscribeDbStatus(callback api.SubscribeDbStatusFunc)
func (*DbInstanceManager) SubscribeInstanceStatus ¶
func (m *DbInstanceManager) SubscribeInstanceStatus(callback api.SubscribeInstanceStatusFunc)
type DbJobSvcHandler ¶
type DbJobSvcHandler struct { proto.UnimplementedDbJobSvcServer *DbInstanceManager GrpcConfig *config.GrpcConfig QuitCtx context.Context }
func NewDbJobSvcHandler ¶
func NewDbJobSvcHandler(config *config.GrpcConfig, quitCtx context.Context) *DbJobSvcHandler
func (*DbJobSvcHandler) NotifyDbStatus ¶
func (*DbJobSvcHandler) Register ¶
func (h *DbJobSvcHandler) Register(m *proto.RegisterInstance, s proto.DbJobSvc_RegisterServer) error
type DbStatusSubscriber ¶
type DbStatusSubscriber struct {
// contains filtered or unexported fields
}
func (*DbStatusSubscriber) OnStatusChanged ¶
func (s *DbStatusSubscriber) OnStatusChanged(instance *DbInstance, db *Database)
func (*DbStatusSubscriber) Subscribe ¶
func (s *DbStatusSubscriber) Subscribe(subscriber api.SubscribeDbStatusFunc)
type GrpcServer ¶
type GrpcServer struct { Config *config.GrpcConfig GrpcServer *grpc.Server Auth *grpcAuth.GrpcAuth SvcHandler *DbJobSvcHandler QuitCtx context.Context }
func NewGrpcServer ¶
func NewGrpcServer(config *config.GrpcConfig, quitCtx context.Context) *GrpcServer
func (*GrpcServer) Init ¶
func (s *GrpcServer) Init(setter server.GlobalSetter) error
func (*GrpcServer) PostInit ¶
func (s *GrpcServer) PostInit(getter server.GlobalGetter) error
func (*GrpcServer) Run ¶
func (s *GrpcServer) Run()
func (*GrpcServer) Shutdown ¶
func (s *GrpcServer) Shutdown(ctx context.Context)
type InstanceStatusSubscriber ¶
type InstanceStatusSubscriber struct {
// contains filtered or unexported fields
}
func (*InstanceStatusSubscriber) OnStatusChanged ¶
func (s *InstanceStatusSubscriber) OnStatusChanged(instance *DbInstance)
func (*InstanceStatusSubscriber) Subscribe ¶
func (s *InstanceStatusSubscriber) Subscribe(subscriber api.SubscribeInstanceStatusFunc)
Click to show internal directories.
Click to hide internal directories.