Documentation
¶
Index ¶
Constants ¶
View Source
const (
NoCollectionErrMsg = "ns doesn't exist"
)
Variables ¶
View Source
var ( // device not found ErrDevNotFound = errors.New("device not found") // token not found ErrTokenNotFound = errors.New("token not found") // authorization set not found ErrAuthSetNotFound = errors.New("authorization set not found") // limit set not found ErrLimitNotFound = errors.New("limit not found") // device already exists ErrObjectExists = errors.New("object exists") // device status unknown ErrDevStatusBroken = errors.New("cannot qualify device status") )
Functions ¶
This section is empty.
Types ¶
type AuthSetFilter ¶
type DataStore ¶
type DataStore interface { // ForEachTenant loops over all tenants and applies opFunc with // for the existing database. If opFunc returns an error for one of // the elements, this function aborts with the same error. ForEachTenant(parentCtx context.Context, opFunc MapFunc) error Ping(ctx context.Context) error // retrieve device by Mender-assigned device ID //returns ErrDevNotFound if device not found GetDeviceById(ctx context.Context, id string) (*model.Device, error) // retrieve device by its identity data // returns ErrDevNotFound if device not found GetDeviceByIdentityDataHash(ctx context.Context, idataHash []byte) (*model.Device, error) // list devices GetDevices( ctx context.Context, skip, limit uint, filter model.DeviceFilter, ) ([]model.Device, error) AddDevice(ctx context.Context, d model.Device) error // updates a single device with deviceID, using data from `up` UpdateDevice(ctx context.Context, deviceID string, up model.DeviceUpdate) error // deletes device DeleteDevice(ctx context.Context, id string) error AddAuthSet(ctx context.Context, set model.AuthSet) error UpsertAuthSetStatus(ctx context.Context, authSet *model.AuthSet) error GetAuthSetByIdDataHashKey( ctx context.Context, idDataHash []byte, key string, ) (*model.AuthSet, error) GetAuthSetByIdDataHashKeyByStatus( ctx context.Context, idDataHash []byte, key string, status string, ) (*model.AuthSet, error) GetAuthSetById(ctx context.Context, id string) (*model.AuthSet, error) GetAuthSetsForDevice(ctx context.Context, devid string) ([]model.AuthSet, error) // RejectAuthSetsForDevice updates the auth set status for all auth sets // with status "accepted" or "preauthorized" to "rejected" RejectAuthSetsForDevice(ctx context.Context, deviceID string) error UpdateAuthSetById(ctx context.Context, authId string, mod model.AuthSetUpdate) error // deletes all auth sets for device DeleteAuthSetsForDevice(ctx context.Context, devid string) error // deletes authentication set for device DeleteAuthSetForDevice(ctx context.Context, devId string, authId string) error // adds JWT to database AddToken(ctx context.Context, t *jwt.Token) error // retrieves JWT from database using JWT Id and device Id // returns ErrTokenNotFound if token not found GetToken(ctx context.Context, jti oid.ObjectID) (*jwt.Token, error) // deletes token DeleteToken(ctx context.Context, jti oid.ObjectID) error // deletes all (tenant's) tokens (identity in context) DeleteTokens(ctx context.Context) error // deletes device token DeleteTokenByDevId(ctx context.Context, dev_id oid.ObjectID) error // put limit information into data store PutLimit(ctx context.Context, lim model.Limit) error // delete limit information from data store DeleteLimit(ctx context.Context, lim string) error // fetch limit information from data store GetLimit(ctx context.Context, name string) (*model.Limit, error) // get the number of devices with a given admission status // computed based on aggregated auth set statuses GetDevCountByStatus(ctx context.Context, status string) (int, error) // gets device status GetDeviceStatus(ctx context.Context, dev_id string) (string, error) MigrateTenant(ctx context.Context, version string, tenant string) error WithAutomigrate() DataStore //call this one if you really know what you are doing. This is supposed to be called only //from cmdPropagateStatusesInventory StoreMigrationVersion(ctx context.Context, version *migrate.Version) error ListTenantsIds( ctx context.Context, ) ([]string, error) }
Click to show internal directories.
Click to hide internal directories.