dimension

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInstanceNotFound = errors.New("dataset api failed to find instance")

ErrInstanceNotFound returned when the given instance ID is not found in the dataset API.

View Source
var ErrInternalError = errors.New("internal error from the dataset api")

ErrInternalError returned when an unrecognised internal error occurs in the dataset API.

View Source
var ErrParseAPIResponse = errors.New("failed to parse dataset api response")

ErrParseAPIResponse used when the dataset API response fails to be parsed.

Functions

This section is empty.

Types

type DatasetClient

type DatasetClient interface {
	GetInstanceBytes(ctx context.Context, userAuthToken, serviceAuthToken, collectionID, instanceID, ifMatch string) (b []byte, eTag string, err error)
	GetInstanceDimensionsBytes(ctx context.Context, serviceAuthToken, instanceID string, q *dataset.QueryParams, ifMatch string) (b []byte, eTag string, err error)
}

DatasetClient represents the dataset client for dataset API

type DatasetStore

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

DatasetStore represents the storage of dimension data.

func NewStore

func NewStore(authToken, datasetAPIURL string, client DatasetClient) *DatasetStore

NewStore returns a new instance of a dimension store.

func (*DatasetStore) GetIDs

func (store *DatasetStore) GetIDs(ctx context.Context, instanceID string) (map[string]string, error)

GetIDs returns all dimensions for a given instanceID

func (*DatasetStore) GetOrder

func (store *DatasetStore) GetOrder(ctx context.Context, instanceID string) ([]string, error)

GetOrder returns list of dimension names in the order they are stored in the input file.

type Dimension

type Dimension struct {
	DimensionName string `json:"dimension"`
	Option        string `json:"option"`
	NodeID        string `json:"node_id"`
}

Dimension which has been cached from the dataset api

type HeaderCache

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

HeaderCache is cache the for order of dimensions in the input file

func NewOrderCache

func NewOrderCache(orderStore OrderStore, cacheTTL time.Duration) *HeaderCache

NewOrderCache returns a new instance of the order cache that uses the given OrderStore.

func (*HeaderCache) GetOrder

func (hc *HeaderCache) GetOrder(ctx context.Context, instanceID string) ([]string, error)

GetOrder returns list of dimension names in the order they are stored in the input file.

type IDStore

type IDStore interface {
	GetIDs(ctx context.Context, instanceID string) (map[string]string, error)
}

IDStore represents the data store for dimension id's

type MemoryCache

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

MemoryCache is an in memory cache of dimensions with database id's.

func NewIDCache

func NewIDCache(idStore IDStore, cacheTTL time.Duration) *MemoryCache

NewIDCache returns a new cache instance that uses the given data store.

func (*MemoryCache) GetNodeIDs

func (mc *MemoryCache) GetNodeIDs(ctx context.Context, instanceID string) (map[string]string, error)

GetNodeIDs returns all dimensions for a given instanceID

type NodeResults

type NodeResults struct {
	Items []Dimension `json:"items"`
}

NodeResults wraps dimension node objects for pagination

type OrderStore

type OrderStore interface {
	GetOrder(ctx context.Context, instanceID string) ([]string, error)
}

OrderStore represents the data store for dimension order

Directories

Path Synopsis
Package dimensiontest is a generated GoMock package.
Package dimensiontest is a generated GoMock package.

Jump to

Keyboard shortcuts

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