mongo

package
v0.0.0-...-2e0ac8a Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Copyright 2018 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.

Copyright 2018 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.

Copyright 2018 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.

Copyright 2018 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.

Copyright 2018 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

View Source
const (
	DbVersion     = "1.5.0"
	DbName        = "deviceauth"
	DbDevicesColl = "devices"
	DbAuthSetColl = "auth_sets"
	DbTokensColl  = "tokens"
	DbLimitsColl  = "limits"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStoreMongo

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

func NewDataStoreMongo

func NewDataStoreMongo(config DataStoreMongoConfig) (*DataStoreMongo, error)

func NewDataStoreMongoWithSession

func NewDataStoreMongoWithSession(session *mgo.Session) *DataStoreMongo

func (*DataStoreMongo) AddAuthSet

func (db *DataStoreMongo) AddAuthSet(ctx context.Context, set model.AuthSet) error

func (*DataStoreMongo) AddDevice

func (db *DataStoreMongo) AddDevice(ctx context.Context, d model.Device) error

func (*DataStoreMongo) AddToken

func (db *DataStoreMongo) AddToken(ctx context.Context, t model.Token) error

func (*DataStoreMongo) DeleteAuthSetForDevice

func (db *DataStoreMongo) DeleteAuthSetForDevice(ctx context.Context, devId string, authId string) error

func (*DataStoreMongo) DeleteAuthSetsForDevice

func (db *DataStoreMongo) DeleteAuthSetsForDevice(ctx context.Context, devid string) error

func (*DataStoreMongo) DeleteBrokenAuthSets

func (db *DataStoreMongo) DeleteBrokenAuthSets(dbName string) error

Deletes auth sets owned by devices that are in decommissioning state and auth sets not owned by any device.

func (*DataStoreMongo) DeleteBrokenTokens

func (db *DataStoreMongo) DeleteBrokenTokens(dbName string) error

Deletes tokens owned by devices that are in decommissioning state and tokens not owned by any device.

func (*DataStoreMongo) DeleteDevice

func (db *DataStoreMongo) DeleteDevice(ctx context.Context, id string) error

func (*DataStoreMongo) DeleteDevicesBeingDecommissioned

func (db *DataStoreMongo) DeleteDevicesBeingDecommissioned(dbName string) error

Deletes devices with decommissioning flag set

func (*DataStoreMongo) DeleteToken

func (db *DataStoreMongo) DeleteToken(ctx context.Context, jti string) error

func (*DataStoreMongo) DeleteTokenByDevId

func (db *DataStoreMongo) DeleteTokenByDevId(ctx context.Context, devId string) error

func (*DataStoreMongo) DeleteTokens

func (db *DataStoreMongo) DeleteTokens(ctx context.Context) error

func (*DataStoreMongo) EnsureIndexes

func (db *DataStoreMongo) EnsureIndexes(ctx context.Context, s *mgo.Session) error

func (*DataStoreMongo) GetAuthSetById

func (db *DataStoreMongo) GetAuthSetById(ctx context.Context, auth_id string) (*model.AuthSet, error)

func (*DataStoreMongo) GetAuthSetByIdDataHashKey

func (db *DataStoreMongo) GetAuthSetByIdDataHashKey(ctx context.Context, idDataHash []byte, key string) (*model.AuthSet, error)

func (*DataStoreMongo) GetAuthSets

func (db *DataStoreMongo) GetAuthSets(ctx context.Context, skip, limit int, filter store.AuthSetFilter) ([]model.DevAdmAuthSet, error)

func (*DataStoreMongo) GetAuthSetsForDevice

func (db *DataStoreMongo) GetAuthSetsForDevice(ctx context.Context, devid string) ([]model.AuthSet, error)

func (*DataStoreMongo) GetBrokenAuthSets

func (db *DataStoreMongo) GetBrokenAuthSets(dbName string) ([]string, error)

Retrieves Ids of the auth sets owned by devices that are in decommissioning state or not owned by any device.

func (*DataStoreMongo) GetBrokenTokens

func (db *DataStoreMongo) GetBrokenTokens(dbName string) ([]string, error)

Get Ids of the tokens owned by devices that are in decommissioning state and tokens not owned by any device.

func (*DataStoreMongo) GetDevCountByStatus

func (db *DataStoreMongo) GetDevCountByStatus(ctx context.Context, status string) (int, error)

func (*DataStoreMongo) GetDeviceById

func (db *DataStoreMongo) GetDeviceById(ctx context.Context, id string) (*model.Device, error)

func (*DataStoreMongo) GetDeviceByIdentityDataHash

func (db *DataStoreMongo) GetDeviceByIdentityDataHash(ctx context.Context, idataHash []byte) (*model.Device, error)

func (*DataStoreMongo) GetDeviceStatus

func (db *DataStoreMongo) GetDeviceStatus(ctx context.Context, devId string) (string, error)

func (*DataStoreMongo) GetDevices

func (db *DataStoreMongo) GetDevices(ctx context.Context, skip, limit uint, filter store.DeviceFilter) ([]model.Device, error)

func (*DataStoreMongo) GetDevicesBeingDecommissioned

func (db *DataStoreMongo) GetDevicesBeingDecommissioned(dbName string) ([]model.Device, error)

Retrieves devices with decommissioning flag set

func (*DataStoreMongo) GetLimit

func (db *DataStoreMongo) GetLimit(ctx context.Context, name string) (*model.Limit, error)

func (*DataStoreMongo) GetTenantDbs

func (db *DataStoreMongo) GetTenantDbs() ([]string, error)

func (*DataStoreMongo) GetToken

func (db *DataStoreMongo) GetToken(ctx context.Context, jti string) (*model.Token, error)

func (*DataStoreMongo) Migrate

func (db *DataStoreMongo) Migrate(ctx context.Context, version string) error

func (*DataStoreMongo) MigrateTenant

func (db *DataStoreMongo) MigrateTenant(ctx context.Context, database, version string) error

func (*DataStoreMongo) PutLimit

func (db *DataStoreMongo) PutLimit(ctx context.Context, lim model.Limit) error

func (*DataStoreMongo) UpdateAuthSet

func (db *DataStoreMongo) UpdateAuthSet(ctx context.Context, filter interface{}, mod model.AuthSetUpdate) error

func (*DataStoreMongo) UpdateDevice

func (db *DataStoreMongo) UpdateDevice(ctx context.Context,
	d model.Device, updev model.DeviceUpdate) error

func (*DataStoreMongo) WithAutomigrate

func (db *DataStoreMongo) WithAutomigrate() store.DataStore

func (*DataStoreMongo) WithMultitenant

func (db *DataStoreMongo) WithMultitenant() *DataStoreMongo

type DataStoreMongoConfig

type DataStoreMongoConfig struct {
	// MGO connection string
	ConnectionString string

	// SSL support
	SSL           bool
	SSLSkipVerify bool

	// Overwrites credentials provided in connection string if provided
	Username string
	Password string
}

Jump to

Keyboard shortcuts

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