store

package
v0.0.0-...-4386724 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: Apache-2.0 Imports: 3 Imported by: 5

Documentation

Overview

Copyright 2017 Northern.tech AS

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	// object not found
	ErrNotFound = errors.New("not found")
)

Functions

This section is empty.

Types

type DataStore

type DataStore interface {
	GetDeviceAuths(ctx context.Context, skip, limit int, filter Filter) ([]model.DeviceAuth, error)

	// find a device auth set with given `id`, returns the device auth set
	// or nil, if auth set was not found, error is set to ErrDevNotFound
	GetDeviceAuth(ctx context.Context, id model.AuthID) (*model.DeviceAuth, error)

	// update or insert device auth set into data store, only non-empty
	// fields will be stored/updated, for instance, to update a status of
	// device auth set with ID "foo":
	//
	// ds.PutDeviceAuth(context.TODO(), &DeviceAuth{
	// 	ID: "foo",
	//      DeviceId: "bar",
	// 	Status: "accepted",
	// })
	PutDeviceAuth(ctx context.Context, dev *model.DeviceAuth) error

	// remove device auth set
	DeleteDeviceAuth(ctx context.Context, id model.AuthID) error

	// remove auth sets owned by device
	DeleteDeviceAuthByDevice(ctx context.Context, id model.DeviceID) error

	// UpdateDeviceAuth updates the auth set (strict update, no upserts).
	UpdateDeviceAuth(ctx context.Context, dev *model.DeviceAuth) error

	MigrateTenant(ctx context.Context, version string, tenant string) error
	WithAutomigrate() DataStore

	InsertDeviceAuth(ctx context.Context, dev *model.DeviceAuth) error

	GetDeviceAuthsByIdentityData(ctx context.Context, idata string) ([]model.DeviceAuth, error)
}

type Filter

type Filter struct {
	// List auth sets owned by this DeviceID
	DeviceID model.DeviceID
	// List auth sets with this status
	Status string
}

Filter wraps filtering information that can be passed to DataStore API when listing auth sets

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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