db

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

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

func Connect

func Connect() (*DataStore, error)

Get establishes a connection to the database and returns the db handle

func Get

func Get() *DataStore

func (*DataStore) Client

func (ds *DataStore) Client() *mongo.Client

func (*DataStore) Db

func (ds *DataStore) Db() *mongo.Database

func (*DataStore) DeleteClient

func (ds *DataStore) DeleteClient(clientId string) (int64, error)

func (*DataStore) DeleteField

func (ds *DataStore) DeleteField(collectionName string, id string) error

func (*DataStore) DeleteFields

func (ds *DataStore) DeleteFields(collection *mongo.Collection, fields *[]structs.Field) error

DeleteFields deletes fields from the database

Params:

collection is the database collection to delete structs.Field structs from

fields is the structs.Field slice containing all Fields that should be deleted

func (*DataStore) DeleteJob

func (ds *DataStore) DeleteJob(jobId string) (int64, error)

func (*DataStore) GetAllJobs

func (ds *DataStore) GetAllJobs() ([]structs.Job, error)

GetJAllJobs gets all jobs

nil will be returned if there are no jobs available

func (*DataStore) GetClientForMachine

func (ds *DataStore) GetClientForMachine() (*structs.Client, error)

GetClientForMachine returns the current db client that matches this machine's hostname. A new client will be created if none is found in the database

func (*DataStore) GetClients

func (ds *DataStore) GetClients() ([]structs.Client, error)

GetClients retrieves all clients that have been registered

func (*DataStore) GetFields

func (ds *DataStore) GetFields(collectionName string) ([]structs.Field, error)

GetFields gets all fields for a given collection

func (*DataStore) GetJobsForClient

func (ds *DataStore) GetJobsForClient(client structs.Client) ([]structs.Job, error)

GetJobsForClient gets all jobs for a given client

nil will be returned if there are no jobs available for the client

func (*DataStore) GetNextJobForClient

func (ds *DataStore) GetNextJobForClient(client *structs.Client) (*structs.Job, error)

GetNextJobForClient returns the next available job in the queue for a given client

nil will be returned if there are no more jobs available

func (*DataStore) InsertFields

func (ds *DataStore) InsertFields(collection *mongo.Collection, fields *[]structs.Field) error

func (*DataStore) LoadSharedConfig

func (ds *DataStore) LoadSharedConfig() error

func (*DataStore) ModifyClient

func (ds *DataStore) ModifyClient(client *structs.Client, mode string) error

func (*DataStore) ModifyJob

func (ds *DataStore) ModifyJob(job *structs.Job, clientID primitive.ObjectID, mode string) error

func (*DataStore) SignInClient

func (ds *DataStore) SignInClient(client *structs.Client) error

Signs out the current machine

func (*DataStore) SignOutClient

func (ds *DataStore) SignOutClient(client *structs.Client) error

Signs out the current machine

func (*DataStore) SignOutThisClient

func (ds *DataStore) SignOutThisClient() error

func (*DataStore) UpdateFields

func (ds *DataStore) UpdateFields(collectionName string, fields *[]structs.Field) error

Jump to

Keyboard shortcuts

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