control

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID         string           `db:"id"`
	Key        string           `db:"upload_key"`
	Name       string           `db:"name"`
	Alias      string           `db:"alias"`
	OS         string           `db:"os"`
	DirsConf   *DirsConf        `db:"dirs_conf"`
	State      *sts.ClientState `db:"state"`
	CreatedAt  time.Time        `db:"created_at"`
	UpdatedAt  time.Time        `db:"updated_at"`
	VerifiedAt pq.NullTime      `db:"verified_at"`
	PingedAt   pq.NullTime      `db:"pinged_at"`
	LoadedAt   pq.NullTime      `db:"loaded_at"`
}

Client represents a client record

type Dataset

type Dataset struct {
	Name       string         `db:"name"`
	SourceConf *SourceConf    `db:"source_conf"`
	ClientID   sql.NullString `db:"client_id"`
	CreatedAt  time.Time      `db:"created_at"`
	UpdatedAt  time.Time      `db:"updated_at"`
}

Dataset represents a dataset record

type DirsConf

type DirsConf struct {
	sts.ClientDirs
}

DirsConf wraps the sts.ClientDirs type

func (*DirsConf) Scan

func (c *DirsConf) Scan(src interface{}) error

Scan transforms the database type to our internal type

func (*DirsConf) Value

func (c *DirsConf) Value() (driver.Value, error)

Value transforms this type to database driver-compatible type

type Postgres

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

Postgres fulfills the sts.ClientManager interface

func NewPostgres

func NewPostgres(
	port uint, host, name, user, pass,
	clientsTable, datasetsTable string,
	idDecoder sts.DecodeClientID,
) (p *Postgres)

NewPostgres creates a new Postgres instance

func (*Postgres) GetClientConf

func (p *Postgres) GetClientConf(clientID string) (conf *sts.ClientConf, err error)

GetClientConf helps fulfill the sts.ClientManager interface

func (*Postgres) GetClientStatus

func (p *Postgres) GetClientStatus(
	clientID,
	clientName,
	clientOS string,
) (status sts.ClientStatus, err error)

GetClientStatus helps fulfill the sts.ClientManager interface

func (*Postgres) IsValid

func (p *Postgres) IsValid(source, clientID string) bool

IsValid fulfills sts.IsKeyValid and determines whether or not the input key (client ID) is allowed to send a file that looks like the input file struct

func (*Postgres) SetClientConfReceived

func (p *Postgres) SetClientConfReceived(clientID string, when time.Time) error

SetClientConfReceived helps fulfill the sts.ClientManager interface

func (*Postgres) SetClientState

func (p *Postgres) SetClientState(clientID string, state sts.ClientState) error

SetClientState helps fulfill the sts.ClientManager interface

type SourceConf

type SourceConf struct {
	sts.SourceConf
}

SourceConf wraps the sts.SourceConf type

func (*SourceConf) Scan

func (c *SourceConf) Scan(src interface{}) error

Scan transforms the database type to our internal type

func (*SourceConf) Value

func (c *SourceConf) Value() (driver.Value, error)

Value transforms this type to database driver-compatible type

Jump to

Keyboard shortcuts

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