Documentation
¶
Overview ¶
Database management for the Fish node
Index ¶
- Variables
- type Database
- func (d *Database) ApplicationCreate(a *types.Application) error
- func (d *Database) ApplicationDeallocate(appUID types.ApplicationUID, requestor string) (*types.ApplicationState, error)
- func (d *Database) ApplicationDelete(uid types.ApplicationUID) (err error)
- func (d *Database) ApplicationGet(uid types.ApplicationUID) (a *types.Application, err error)
- func (d *Database) ApplicationIsAllocated(appUID types.ApplicationUID) (err error)
- func (d *Database) ApplicationList() (as []types.Application, err error)
- func (d *Database) ApplicationListGetStatusNew() (as []types.Application, err error)
- func (d *Database) ApplicationResourceAccessCreate(ra *types.ApplicationResourceAccess) error
- func (d *Database) ApplicationResourceAccessDelete(uid types.ApplicationResourceAccessUID) error
- func (d *Database) ApplicationResourceAccessDeleteByResource(appresUID types.ApplicationResourceUID) error
- func (d *Database) ApplicationResourceAccessList() (ra []types.ApplicationResourceAccess, err error)
- func (d *Database) ApplicationResourceAccessSingleUseKey(username string, key string) (*types.ApplicationResourceAccess, error)
- func (d *Database) ApplicationResourceAccessSingleUsePasswordHash(username string, hash string) (*types.ApplicationResourceAccess, error)
- func (d *Database) ApplicationResourceCreate(r *types.ApplicationResource) error
- func (d *Database) ApplicationResourceDelete(uid types.ApplicationResourceUID) error
- func (d *Database) ApplicationResourceGet(uid types.ApplicationResourceUID) (res *types.ApplicationResource, err error)
- func (d *Database) ApplicationResourceGetByApplication(appUID types.ApplicationUID) (res *types.ApplicationResource, err error)
- func (d *Database) ApplicationResourceGetByIP(ip string) (res *types.ApplicationResource, err error)
- func (d *Database) ApplicationResourceList() (rs []types.ApplicationResource, err error)
- func (d *Database) ApplicationResourceListNode(nodeUID types.NodeUID) (rs []types.ApplicationResource, err error)
- func (d *Database) ApplicationResourceSave(res *types.ApplicationResource) error
- func (d *Database) ApplicationStateCreate(as *types.ApplicationState) error
- func (d *Database) ApplicationStateDelete(uid types.ApplicationStateUID) (err error)
- func (d *Database) ApplicationStateGet(uid types.ApplicationStateUID) (as *types.ApplicationState, err error)
- func (d *Database) ApplicationStateGetByApplication(appUID types.ApplicationUID) (state *types.ApplicationState, err error)
- func (*Database) ApplicationStateIsActive(status types.ApplicationStatus) bool
- func (d *Database) ApplicationStateList() (ass []types.ApplicationState, err error)
- func (d *Database) ApplicationStateListByApplication(appUID types.ApplicationUID) (states []types.ApplicationState, err error)
- func (d *Database) ApplicationStateListLatest() (out []types.ApplicationState, err error)
- func (d *Database) ApplicationTaskCreate(at *types.ApplicationTask) error
- func (d *Database) ApplicationTaskDelete(uid types.ApplicationTaskUID) (err error)
- func (d *Database) ApplicationTaskGet(uid types.ApplicationTaskUID) (at *types.ApplicationTask, err error)
- func (d *Database) ApplicationTaskList() (at []types.ApplicationTask, err error)
- func (d *Database) ApplicationTaskListByApplication(uid types.ApplicationUID) (at []types.ApplicationTask, err error)
- func (d *Database) ApplicationTaskListByApplicationAndWhen(appUID types.ApplicationUID, when types.ApplicationStatus) (at []types.ApplicationTask, err error)
- func (d *Database) ApplicationTaskSave(at *types.ApplicationTask) error
- func (d *Database) CompactDB() error
- func (d *Database) Del(prefix, key string) error
- func (d *Database) Get(prefix, key string, obj any) error
- func (d *Database) GetNode() *types.Node
- func (d *Database) GetNodeLocation() string
- func (d *Database) GetNodeName() string
- func (d *Database) GetNodeUID() types.NodeUID
- func (d *Database) Has(prefix, key string) (bool, error)
- func (d *Database) LabelCreate(l *types.Label) error
- func (d *Database) LabelDelete(uid types.LabelUID) error
- func (d *Database) LabelGet(uid types.LabelUID) (label *types.Label, err error)
- func (d *Database) LabelList(filters types.LabelListGetParams) (labels []types.Label, err error)
- func (d *Database) LabelListName(name string) (labels []types.Label, err error)
- func (d *Database) NewUID() uuid.UUID
- func (d *Database) NodeActiveList() (ns []types.Node, err error)
- func (d *Database) NodeCreate(n *types.Node) error
- func (d *Database) NodeGet(name string) (node *types.Node, err error)
- func (d *Database) NodeList() (ns []types.Node, err error)
- func (d *Database) NodePing(node *types.Node) error
- func (d *Database) NodeSave(node *types.Node) error
- func (d *Database) Scan(prefix string, f func(string) error) error
- func (d *Database) ServiceMappingByApplicationAndDest(appUID types.ApplicationUID, dest string) string
- func (d *Database) ServiceMappingCreate(sm *types.ServiceMapping) error
- func (d *Database) ServiceMappingDelete(uid types.ServiceMappingUID) error
- func (d *Database) ServiceMappingGet(uid types.ServiceMappingUID) (sm *types.ServiceMapping, err error)
- func (d *Database) ServiceMappingList() (sms []types.ServiceMapping, err error)
- func (d *Database) ServiceMappingListByApplication(appUID types.ApplicationUID) (sms []types.ServiceMapping, err error)
- func (d *Database) ServiceMappingSave(sm *types.ServiceMapping) error
- func (d *Database) Set(prefix, key string, obj any) error
- func (d *Database) SetNode(node types.Node)
- func (d *Database) Shutdown() error
- func (d *Database) UserAuth(name string, password string) *types.User
- func (d *Database) UserCreate(u *types.User) error
- func (d *Database) UserDelete(name string) error
- func (d *Database) UserGet(name string) (u *types.User, err error)
- func (d *Database) UserList() (us []types.User, err error)
- func (d *Database) UserNew(name string, password string) (string, *types.User, error)
- func (d *Database) UserSave(u *types.User) error
Constants ¶
This section is empty.
Variables ¶
var ErrObjectNotFound = bitcask.ErrObjectNotFound
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database implements necessary functions to manipulate the internal database
func (*Database) ApplicationCreate ¶
func (d *Database) ApplicationCreate(a *types.Application) error
ApplicationCreate makes new Application
func (*Database) ApplicationDeallocate ¶
func (d *Database) ApplicationDeallocate(appUID types.ApplicationUID, requestor string) (*types.ApplicationState, error)
ApplicationDeallocate helps with creating deallocate/recalled state for the Application
func (*Database) ApplicationDelete ¶
func (d *Database) ApplicationDelete(uid types.ApplicationUID) (err error)
ApplicationDelete removes the Application
func (*Database) ApplicationGet ¶
func (d *Database) ApplicationGet(uid types.ApplicationUID) (a *types.Application, err error)
ApplicationGet returns Application by UID
func (*Database) ApplicationIsAllocated ¶
func (d *Database) ApplicationIsAllocated(appUID types.ApplicationUID) (err error)
ApplicationIsAllocated returns if specific Application is allocated
func (*Database) ApplicationList ¶
func (d *Database) ApplicationList() (as []types.Application, err error)
ApplicationFind lists Applications by filter
func (*Database) ApplicationListGetStatusNew ¶
func (d *Database) ApplicationListGetStatusNew() (as []types.Application, err error)
ApplicationListGetStatusNew returns new Applications
func (*Database) ApplicationResourceAccessCreate ¶
func (d *Database) ApplicationResourceAccessCreate(ra *types.ApplicationResourceAccess) error
ApplicationResourceAccessCreate makes new ResourceAccess
func (*Database) ApplicationResourceAccessDelete ¶
func (d *Database) ApplicationResourceAccessDelete(uid types.ApplicationResourceAccessUID) error
ApplicationResourceAccessDelete removes ResourceAccess by UID
func (*Database) ApplicationResourceAccessDeleteByResource ¶
func (d *Database) ApplicationResourceAccessDeleteByResource(appresUID types.ApplicationResourceUID) error
ApplicationResourceAccessDeleteByResource removes ResourceAccess by ResourceUID
func (*Database) ApplicationResourceAccessList ¶
func (d *Database) ApplicationResourceAccessList() (ra []types.ApplicationResourceAccess, err error)
ApplicationResourceAccessList returns a list of all known ApplicationResourceAccess objects
func (*Database) ApplicationResourceAccessSingleUseKey ¶
func (d *Database) ApplicationResourceAccessSingleUseKey(username string, key string) (*types.ApplicationResourceAccess, error)
ApplicationResourceAccessSingleUseKey retrieves the key from the database *AND* deletes it. Users must request a new resource access to connect again.
func (*Database) ApplicationResourceAccessSingleUsePasswordHash ¶
func (d *Database) ApplicationResourceAccessSingleUsePasswordHash(username string, hash string) (*types.ApplicationResourceAccess, error)
ApplicationResourceAccessSingleUsePasswordHash retrieves the password hash from the database *AND* deletes it. Users must request a new Resource Access to connect again.
func (*Database) ApplicationResourceCreate ¶
func (d *Database) ApplicationResourceCreate(r *types.ApplicationResource) error
ApplicationResourceCreate makes new Resource
func (*Database) ApplicationResourceDelete ¶
func (d *Database) ApplicationResourceDelete(uid types.ApplicationResourceUID) error
ApplicationResourceDelete removes Resource
func (*Database) ApplicationResourceGet ¶
func (d *Database) ApplicationResourceGet(uid types.ApplicationResourceUID) (res *types.ApplicationResource, err error)
ApplicationResourceGet returns Resource by it's UID
func (*Database) ApplicationResourceGetByApplication ¶
func (d *Database) ApplicationResourceGetByApplication(appUID types.ApplicationUID) (res *types.ApplicationResource, err error)
ApplicationResourceGetByApplication returns ApplicationResource by ApplicationUID
func (*Database) ApplicationResourceGetByIP ¶
func (d *Database) ApplicationResourceGetByIP(ip string) (res *types.ApplicationResource, err error)
ApplicationResourceGetByIP returns Resource by it's IP address
func (*Database) ApplicationResourceList ¶
func (d *Database) ApplicationResourceList() (rs []types.ApplicationResource, err error)
ApplicationResourceList returns a list of all known ApplicationResource objects
func (*Database) ApplicationResourceListNode ¶
func (d *Database) ApplicationResourceListNode(nodeUID types.NodeUID) (rs []types.ApplicationResource, err error)
ApplicationResourceListNode returns list of resources for provided NodeUID
func (*Database) ApplicationResourceSave ¶
func (d *Database) ApplicationResourceSave(res *types.ApplicationResource) error
ApplicationResourceSave stores ApplicationResource
func (*Database) ApplicationStateCreate ¶
func (d *Database) ApplicationStateCreate(as *types.ApplicationState) error
ApplicationStateCreate makes new ApplicationState
func (*Database) ApplicationStateDelete ¶
func (d *Database) ApplicationStateDelete(uid types.ApplicationStateUID) (err error)
ApplicationStateDelete removes the ApplicationState
func (*Database) ApplicationStateGet ¶
func (d *Database) ApplicationStateGet(uid types.ApplicationStateUID) (as *types.ApplicationState, err error)
ApplicationStateGet returns specific ApplicationState
func (*Database) ApplicationStateGetByApplication ¶
func (d *Database) ApplicationStateGetByApplication(appUID types.ApplicationUID) (state *types.ApplicationState, err error)
ApplicationStateGetByApplication returns latest ApplicationState of requested ApplicationUID
func (*Database) ApplicationStateIsActive ¶
func (*Database) ApplicationStateIsActive(status types.ApplicationStatus) bool
ApplicationStateIsActive returns false if Status in ERROR, DEALLOCATE or DEALLOCATED state
func (*Database) ApplicationStateList ¶
func (d *Database) ApplicationStateList() (ass []types.ApplicationState, err error)
ApplicationStateList returns list of ApplicationStates
func (*Database) ApplicationStateListByApplication ¶
func (d *Database) ApplicationStateListByApplication(appUID types.ApplicationUID) (states []types.ApplicationState, err error)
ApplicationStateListByApplication returns all ApplicationStates with ApplicationUID
func (*Database) ApplicationStateListLatest ¶
func (d *Database) ApplicationStateListLatest() (out []types.ApplicationState, err error)
ApplicationStateListLatest returns list of latest ApplicationState per Application
func (*Database) ApplicationTaskCreate ¶
func (d *Database) ApplicationTaskCreate(at *types.ApplicationTask) error
ApplicationTaskCreate makes a new ApplicationTask
func (*Database) ApplicationTaskDelete ¶
func (d *Database) ApplicationTaskDelete(uid types.ApplicationTaskUID) (err error)
ApplicationTaskDelete removes the ApplicationTask
func (*Database) ApplicationTaskGet ¶
func (d *Database) ApplicationTaskGet(uid types.ApplicationTaskUID) (at *types.ApplicationTask, err error)
ApplicationTaskGet returns the ApplicationTask by ApplicationTaskUID
func (*Database) ApplicationTaskList ¶
func (d *Database) ApplicationTaskList() (at []types.ApplicationTask, err error)
ApplicationTaskList returns all known ApplicationTasks
func (*Database) ApplicationTaskListByApplication ¶
func (d *Database) ApplicationTaskListByApplication(uid types.ApplicationUID) (at []types.ApplicationTask, err error)
ApplicationTaskFindByApplication allows to find all the ApplicationTasks by ApplicationUID
func (*Database) ApplicationTaskListByApplicationAndWhen ¶
func (d *Database) ApplicationTaskListByApplicationAndWhen(appUID types.ApplicationUID, when types.ApplicationStatus) (at []types.ApplicationTask, err error)
ApplicationTaskListByApplicationAndWhen returns list of ApplicationTasks by ApplicationUID and When it need to be executed
func (*Database) ApplicationTaskSave ¶
func (d *Database) ApplicationTaskSave(at *types.ApplicationTask) error
ApplicationTaskSave stores the ApplicationTask
func (*Database) GetNodeLocation ¶
GetNodeLocation returns current node location
func (*Database) GetNodeName ¶
GetNodeName returns current node name
func (*Database) GetNodeUID ¶
GetNodeUID returns node UID
func (*Database) LabelCreate ¶
LabelCreate makes new Label
func (*Database) LabelDelete ¶
LabelDelete deletes the Label by UID
func (*Database) LabelListName ¶
func (*Database) NodeActiveList ¶
NodeActiveList lists all the nodes in the cluster
func (*Database) NodeCreate ¶
NodeCreate makes new Node
func (*Database) Scan ¶
Scan iterates over key prefixes and executing the provided function for each one
func (*Database) ServiceMappingByApplicationAndDest ¶
func (d *Database) ServiceMappingByApplicationAndDest(appUID types.ApplicationUID, dest string) string
ServiceMappingByApplicationAndDest is trying to find the ServiceMapping record with Application and Location The application in priority, location - secondary priority, if no such records found - default will be used.
func (*Database) ServiceMappingCreate ¶
func (d *Database) ServiceMappingCreate(sm *types.ServiceMapping) error
ServiceMappingCreate makes new ServiceMapping
func (*Database) ServiceMappingDelete ¶
func (d *Database) ServiceMappingDelete(uid types.ServiceMappingUID) error
ServiceMappingDelete removes ServiceMapping
func (*Database) ServiceMappingGet ¶
func (d *Database) ServiceMappingGet(uid types.ServiceMappingUID) (sm *types.ServiceMapping, err error)
ServiceMappingGet returns ServiceMapping by UID
func (*Database) ServiceMappingList ¶
func (d *Database) ServiceMappingList() (sms []types.ServiceMapping, err error)
ServiceMappingFind returns list of ServiceMappings that fits the filter
func (*Database) ServiceMappingListByApplication ¶
func (d *Database) ServiceMappingListByApplication(appUID types.ApplicationUID) (sms []types.ServiceMapping, err error)
ServiceMappingByApplication returns ServiceMapping list with specified ApplicationUID
func (*Database) ServiceMappingSave ¶
func (d *Database) ServiceMappingSave(sm *types.ServiceMapping) error
ServiceMappingSave stores ServiceMapping
func (*Database) UserCreate ¶
UserCreate makes new User
func (*Database) UserDelete ¶
UserDelete removes User