import "./"
- Constants
- func ChkErr(err error)
- func ChkErrFatal(err error)
- func Debug(msg string)
- func Err(msg string)
- func GetHttpsCredentials() string
- func GetStoreURLFromDsHref(href string) (string, error)
- func Info(msg string)
- func NewDataboxHTTPsAPI() *http.Client
- func NewDataboxHTTPsAPIWithPaths(cmRootCaPath string) *http.Client
- func Warn(msg string)
- type AggregationType
- type ArbiterClient
- func NewArbiterClient(arbiterTokenPath string, zmqPublicKeyPath string, arbiterZMQURI string) (*ArbiterClient, error)
- func (arb *ArbiterClient) GetRootDataSourceCatalogue() (HypercatRoot, error)
- func (arb *ArbiterClient) GrantComponentPermission()
- func (arb *ArbiterClient) GrantContainerPermissions(permissions ContainerPermissions) error
- func (arb *ArbiterClient) InvalidateCache(href string, method string)
- func (arb *ArbiterClient) RegesterDataboxComponent(name string, tokenString string, databoxType DataboxType) error
- func (arb *ArbiterClient) RemoveDataboxComponent()
- func (arb *ArbiterClient) RequestToken(href string, method string) ([]byte, error)
- func (arb *ArbiterClient) RevokeComponentPermission()
- type ContainerManagerOptions
- type ContainerPermissions
- type CoreStoreClient
- func NewCoreStoreClient(arbiterClient *ArbiterClient, zmqPublicKeyPath string, storeEndPoint string, enableLogging bool) *CoreStoreClient
- func NewDefaultCoreStoreClient(storeEndPoint string) *CoreStoreClient
- func (csc *CoreStoreClient) GetStoreDataSourceCatalogue(href string) (HypercatRoot, error)
- func (csc *CoreStoreClient) RegisterDatasource(metadata DataSourceMetadata) error
- type DataSource
- type DataSourceMetadata
- type DataboxType
- type ExportWhitelist
- type ExternalWhitelist
- type Filter
- type FilterType
- type HypercatItem
- type HypercatRoot
- type KVStore
- func (kvj *KVStore) Delete(dataSourceID string, key string) error
- func (kvj *KVStore) DeleteAll(dataSourceID string) error
- func (kvj *KVStore) ListKeys(dataSourceID string) ([]string, error)
- func (kvj *KVStore) Observe(dataSourceID string) (<-chan ObserveResponse, error)
- func (kvj *KVStore) ObserveKey(dataSourceID string, key string) (<-chan ObserveResponse, error)
- func (kvj *KVStore) Read(dataSourceID string, key string) ([]byte, error)
- func (kvj *KVStore) Write(dataSourceID string, key string, payload []byte) error
- type LogEntries
- type Logger
- func New(store *CoreStoreClient, outputDebugLogs bool) (*Logger, error)
- func (l Logger) ChkErr(err error)
- func (l Logger) Debug(msg string)
- func (l Logger) Err(msg string)
- func (l Logger) GetLastNLogEntries(n int) Logs
- func (l Logger) GetLastNLogEntriesRaw(n int) []byte
- func (l Logger) Info(msg string)
- func (l Logger) Warn(msg string)
- type Logs
- type Macaroon
- type Manifest
- type ObserveResponse
- type Package
- type RelValPair
- type RelValPairBool
- type Repository
- type ResourceRequirements
- type Route
- type SLA
- type StoreContentType
- type StoreType
- type TSBlobStore
- func (tbs *TSBlobStore) Earliest(dataSourceID string) ([]byte, error)
- func (tbs *TSBlobStore) FirstN(dataSourceID string, n int) ([]byte, error)
- func (tbs *TSBlobStore) LastN(dataSourceID string, n int) ([]byte, error)
- func (tbs *TSBlobStore) Latest(dataSourceID string) ([]byte, error)
- func (tbs *TSBlobStore) Length(dataSourceID string) (int, error)
- func (tbs *TSBlobStore) Observe(dataSourceID string) (<-chan ObserveResponse, error)
- func (tbs *TSBlobStore) Range(dataSourceID string, formTimeStamp int64, toTimeStamp int64) ([]byte, error)
- func (tbs *TSBlobStore) Since(dataSourceID string, sinceTimeStamp int64) ([]byte, error)
- func (tbs *TSBlobStore) Write(dataSourceID string, payload []byte) error
- func (tbs *TSBlobStore) WriteAt(dataSourceID string, timstamp int64, payload []byte) error
- type TSStore
- func (tsc TSStore) Earliest(dataSourceID string) ([]byte, error)
- func (tsc TSStore) FirstN(dataSourceID string, n int, opt TimeSeriesQueryOptions) ([]byte, error)
- func (tsc TSStore) LastN(dataSourceID string, n int, opt TimeSeriesQueryOptions) ([]byte, error)
- func (tsc TSStore) Latest(dataSourceID string) ([]byte, error)
- func (tsc TSStore) Length(dataSourceID string) (int, error)
- func (tsc TSStore) Observe(dataSourceID string) (<-chan ObserveResponse, error)
- func (tsc TSStore) Range(dataSourceID string, formTimeStamp int64, toTimeStamp int64, opt TimeSeriesQueryOptions) ([]byte, error)
- func (tsc TSStore) Since(dataSourceID string, sinceTimeStamp int64, opt TimeSeriesQueryOptions) ([]byte, error)
- func (tsc TSStore) Write(dataSourceID string, payload []byte) error
- func (tsc TSStore) WriteAt(dataSourceID string, timstamp int64, payload []byte) error
- type TimeSeriesQueryOptions
arbiterClient.go coreStoreClient.go coreStoreKV.go coreStoreTS.go coreStoreTSBlob.go databoxRequest.go databoxlog.go export.go helperFunction.go types.go
const (
Equals FilterType = "equals"
Contains FilterType = "contains"
Sum AggregationType = "sum"
Count AggregationType = "count"
Min AggregationType = "min"
Max AggregationType = "max"
Mean AggregationType = "mean"
Median AggregationType = "median"
StandardDeviation AggregationType = "sd"
)
Allowed values for FilterType and AggregationFunction
const DefaultArbiterKeyPath = "/run/secrets/ARBITER_TOKEN"
const DefaultArbiterURI = "tcp://arbiter:4444"
const DefaultHTTPSCertPath = "/run/secrets/DATABOX.pem"
DefaultHTTPSCertPath is the defaut loaction where apps and drivers can find the https certivicats needed to offer a secure UI
const DefaultHTTPSRootCertPath = "/run/secrets/DATABOX_ROOT_CA"
DefaultHTTPSRootCertPath contins the Public key of this databoxes Root certificate needed to verify requests to other components (used in )
const DefaultStorePublicKeyPath = "/run/secrets/ZMQ_PUBLIC_KEY"
func ChkErr(err error)
func ChkErrFatal(err error)
func Debug(msg string)
func Err(msg string)
func GetHttpsCredentials() string
GetHttpsCredentials Returns a string containing the HTTPS credentials to pass to https server when offering an https server. These are read form /run/secrets/DATABOX.pem and are generated by the container-manger at run time.
func GetStoreURLFromDsHref(href string) (string, error)
GetStoreURLFromDsHref extracts the base store url from the href provied in the hypercat descriptions.
func Info(msg string)
func NewDataboxHTTPsAPI() *http.Client
func NewDataboxHTTPsAPIWithPaths(cmRootCaPath string) *http.Client
func Warn(msg string)
type AggregationType string
type ArbiterClient struct {
ArbiterToken string
ZestC zest.ZestClient
// contains filtered or unexported fields
}
func NewArbiterClient(arbiterTokenPath string, zmqPublicKeyPath string, arbiterZMQURI string) (*ArbiterClient, error)
NewArbiterClient returns an arbiter client for use by components that require conunication with the arbiter
func (*ArbiterClient) GetRootDataSourceCatalogue
func (arb *ArbiterClient) GetRootDataSourceCatalogue() (HypercatRoot, error)
GetRootDataSourceCatalogue is used by the container manager to access the Root hypercat catalogue
func (*ArbiterClient) GrantComponentPermission
func (arb *ArbiterClient) GrantComponentPermission()
func (*ArbiterClient) GrantContainerPermissions
func (arb *ArbiterClient) GrantContainerPermissions(permissions ContainerPermissions) error
GrantContainerPermissions allows the container manager to grant permissions to an app or driver on a registered store.
func (*ArbiterClient) InvalidateCache
func (arb *ArbiterClient) InvalidateCache(href string, method string)
InvalidateCache can be used to remove a token from the arbiterClient cache. This is done automatically if the token is rejected.
func (*ArbiterClient) RegesterDataboxComponent
func (arb *ArbiterClient) RegesterDataboxComponent(name string, tokenString string, databoxType DataboxType) error
RegesterDataboxComponent allows the container manager to register a new app, driver or store with the arbiter
func (*ArbiterClient) RemoveDataboxComponent
func (arb *ArbiterClient) RemoveDataboxComponent()
func (*ArbiterClient) RequestToken
func (arb *ArbiterClient) RequestToken(href string, method string) ([]byte, error)
RequestToken is used internally to request a token from the arbiter
func (*ArbiterClient) RevokeComponentPermission
func (arb *ArbiterClient) RevokeComponentPermission()
type ContainerManagerOptions struct {
Version string
SwarmAdvertiseAddress string
DefaultRegistryHost string
DefaultRegistry string
DefaultAppStore string
DefaultStoreImage string
ContainerManagerImage string
CoreUIImage string
ArbiterImage string
CoreNetworkImage string
CoreNetworkRelayImage string
AppServerImage string
ExportServiceImage string
EnableDebugLogging bool
ClearSLAs bool
OverridePasword string
Hostname string
InternalIPs []string
ExternalIP string
HostPath string
Arch string //current architecture used to chose the correct docker images "" for x86 or "arm64v8" for arm64v8 ;-)
}
ContainerManagerOptions is used to configure the Container Manager
type ContainerPermissions struct {
Name string `json:"name"`
Route Route `json:"route"`
Caveats []string `json:"caveats"`
}
type CoreStoreClient struct {
ZestC zest.ZestClient
Arbiter *ArbiterClient
ZEndpoint string
DEndpoint string
KVJSON *KVStore
KVText *KVStore
KVBin *KVStore
TSBlobJSON *TSBlobStore
TSBlobText *TSBlobStore
TSBlobBin *TSBlobStore
TSJSON *TSStore
}
func NewCoreStoreClient(arbiterClient *ArbiterClient, zmqPublicKeyPath string, storeEndPoint string, enableLogging bool) *CoreStoreClient
func NewDefaultCoreStoreClient(storeEndPoint string) *CoreStoreClient
func (*CoreStoreClient) GetStoreDataSourceCatalogue
func (csc *CoreStoreClient) GetStoreDataSourceCatalogue(href string) (HypercatRoot, error)
func (*CoreStoreClient) RegisterDatasource
func (csc *CoreStoreClient) RegisterDatasource(metadata DataSourceMetadata) error
RegisterDatasource is used by apps and drivers to register datasource in stores they own.
type DataSource struct {
Type string `json:"type"`
Required bool `json:"required"`
Name string `json:"name"`
Clientid string `json:"clientid"`
Granularities []string `json:"granularities"`
Hypercat HypercatItem `json:"hypercat"`
}
type DataSourceMetadata struct {
Description string
ContentType string
Vendor string
DataSourceType string
DataSourceID string
StoreType StoreType
IsActuator bool
Unit string
Location string
}
func HypercatToDataSourceMetadata(hypercatDataSourceDescription string) (DataSourceMetadata, string, error)
HypercatToDataSourceMetadata is a helper function to convert the hypercat description of a datasource to a DataSourceMetadata instance Also returns the store url for this data source.
type DataboxType string
const (
DataboxTypeApp DataboxType = "app"
DataboxTypeDriver DataboxType = "driver"
DataboxTypeStore DataboxType = "store"
)
type ExportWhitelist struct {
Url string `json:"url"`
Description string `json:"description"`
}
type ExternalWhitelist struct {
Urls []string `json:"urls"`
Description string `json:"description"`
}
type Filter struct {
TagName string
FilterType FilterType
Value string
}
Filter types to hold the required data to apply the filtering functions of the structured json API
type FilterType string
type HypercatItem struct {
ItemMetadata []interface{} `json:"item-metadata"`
Href string `json:"href"`
}
type HypercatRoot struct {
CatalogueMetadata []RelValPair `json:"catalogue-metadata"`
Items []HypercatItem `json:"items"`
}
type KVStore struct {
// contains filtered or unexported fields
}
func (kvj *KVStore) Delete(dataSourceID string, key string) error
Delete deletes data under the key.
func (kvj *KVStore) DeleteAll(dataSourceID string) error
DeleteAll deletes all keys and data from the datasource.
func (kvj *KVStore) ListKeys(dataSourceID string) ([]string, error)
ListKeys returns an array of key registed under the dataSourceID
func (kvj *KVStore) Observe(dataSourceID string) (<-chan ObserveResponse, error)
func (*KVStore) ObserveKey
func (kvj *KVStore) ObserveKey(dataSourceID string, key string) (<-chan ObserveResponse, error)
func (kvj *KVStore) Read(dataSourceID string, key string) ([]byte, error)
Read will read the vale store at under tha key return data is a object of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (kvj *KVStore) Write(dataSourceID string, key string, payload []byte) error
Write Write will add data to the key value data store.
type LogEntries struct {
Msg string `json:"msg"`
Type string `json:"type"`
}
type Logger struct {
Store *CoreStoreClient
}
func New(store *CoreStoreClient, outputDebugLogs bool) (*Logger, error)
func (l Logger) ChkErr(err error)
func (l Logger) Debug(msg string)
func (l Logger) Err(msg string)
func (Logger) GetLastNLogEntries
func (l Logger) GetLastNLogEntries(n int) Logs
func (Logger) GetLastNLogEntriesRaw
func (l Logger) GetLastNLogEntriesRaw(n int) []byte
func (l Logger) Info(msg string)
func (l Logger) Warn(msg string)
type Logs []LogEntries
type Macaroon string
type Manifest struct {
ManifestVersion int `json:"manifest-version"` //
Name string `json:"name"`
DataboxType DataboxType `json:"databox-type"`
Version string `json:"version"` //this is databox version e.g 0.3.1
Description string `json:"description"` // free text description
Author string `json:"author"` //Tosh Brown <[email protected]>
License string `json:"license"` //Software licence
Tags []string `json:"tags"` //search tags
Homepage string `json:"homepage"` //homepage url
Repository Repository `json:"repository"`
Packages []Package `json:"packages"`
DataSources []DataSource `json:"datasources"`
ExportWhitelists []ExportWhitelist `json:"export-whitelist"`
ExternalWhitelist []ExternalWhitelist `json:"external-whitelist"`
ResourceRequirements ResourceRequirements `json:"resource-requirements"`
DisplayName string `json:"displayName"`
StoreURL string `json:"storeUrl"`
}
type ObserveResponse struct {
TimestampMS int64
DataSourceID string
Key string
Data []byte
}
OBSERVE RESPONSE
type Package struct {
Name string `json:"name"`
Purpose string `json:"purpose"`
Install string `json:"install"`
Risks string `json:"risks"`
Benefits string `json:"benefits"`
DataSources []string `json:"datastores"`
}
type RelValPair struct {
Rel string `json:"rel"`
Val string `json:"val"`
}
type RelValPairBool struct {
Rel string `json:"rel"`
Val bool `json:"val"`
}
type Repository struct {
Type string `json:"Type"`
Url string `json:"url"`
}
type ResourceRequirements struct {
Store string `json:"store"`
}
type Route struct {
Target string `json:"target"`
Path string `json:"path"`
Method string `json:"method"`
}
type SLA struct {
ManifestVersion int `json:"manifest-version"` //
Name string `json:"name"` // container name e.g core-store
Image string `json:"image"` //docker image tag e.g datboxsystems/core-store-amd64
DataboxType DataboxType `json:"databox-type"`
Version string `json:"version"` //this is databox version e.g 0.3.1
Description string `json:"description"` // free text description
Author string `json:"author"` //Tosh Brown <[email protected]>
License string `json:"license"` //Software licence
Tags []string `json:"tags"` //search tags
Homepage string `json:"homepage"` //homepage url
Repository Repository `json:"repository"`
Packages []Package `json:"packages"`
AllowedCombinations []string `json:"allowed-combinations"`
Datasources []DataSource `json:"datasources"`
ExportWhitelists []ExportWhitelist `json:"export-whitelist"`
ExternalWhitelist []ExternalWhitelist `json:"external-whitelist"`
ResourceRequirements ResourceRequirements `json:"resource-requirements"`
DisplayName string `json:"displayName"`
StoreURL string `json:"storeUrl"`
Registry string `json:"registry"`
}
type StoreContentType string
const ContentTypeBINARY StoreContentType = "BINARY"
const ContentTypeJSON StoreContentType = "JSON"
const ContentTypeTEXT StoreContentType = "TEXT"
type StoreType string
const StoreTypeKV StoreType = "kv"
const StoreTypeTS StoreType = "ts"
const StoreTypeTSBlob StoreType = "ts/blob"
type TSBlobStore struct {
// contains filtered or unexported fields
}
func (tbs *TSBlobStore) Earliest(dataSourceID string) ([]byte, error)
Earliest will retrieve the first entry stored at the requested datasource ID return data is a byte array contingin of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tbs *TSBlobStore) FirstN(dataSourceID string, n int) ([]byte, error)
FirstN will retrieve the first N entries stored at the requested datasource ID return data is a byte array contingin of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tbs *TSBlobStore) LastN(dataSourceID string, n int) ([]byte, error)
LastN will retrieve the last N entries stored at the requested datasource ID return data is a byte array contingin of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tbs *TSBlobStore) Latest(dataSourceID string) ([]byte, error)
TSBlobLatest will retrieve the last entry stored at the requested datasource ID return data is a byte array contingin of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tbs *TSBlobStore) Length(dataSourceID string) (int, error)
TSBlobLength returns then number of items stored in the timeseries
func (tbs *TSBlobStore) Observe(dataSourceID string) (<-chan ObserveResponse, error)
Observe allows you to get notifications when a new value is written by a driver the returned chan receives chan ObserveResponse the data value og which contins json of the form {"TimestampMS":213123123,"Json":byte[]}
func (tbs *TSBlobStore) Range(dataSourceID string, formTimeStamp int64, toTimeStamp int64) ([]byte, error)
Range will retrieve all entries between formTimeStamp and toTimeStamp timestamp in ms since unix epoch return data is a byte array contingin of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tbs *TSBlobStore) Since(dataSourceID string, sinceTimeStamp int64) ([]byte, error)
Since will retrieve all entries since the requested timestamp (ms since unix epoch) return data is a byte array contingin of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tbs *TSBlobStore) Write(dataSourceID string, payload []byte) error
Write will add data to the times series data store. Data will be time stamped at insertion (format ms since 1970)
func (tbs *TSBlobStore) WriteAt(dataSourceID string, timstamp int64, payload []byte) error
WriteAt will add data to the times series data store. Data will be time stamped with the timstamp provided in the timstamp paramiter (format ms since 1970)
type TSStore struct {
// contains filtered or unexported fields
}
func (tsc TSStore) Earliest(dataSourceID string) ([]byte, error)
Earliest will retrieve the first entry stored at the requested datasource ID return data is a JSON object of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tsc TSStore) FirstN(dataSourceID string, n int, opt TimeSeriesQueryOptions) ([]byte, error)
FirstN will retrieve the first N entries stored at the requested datasource ID return data is an array of JSON objects of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tsc TSStore) LastN(dataSourceID string, n int, opt TimeSeriesQueryOptions) ([]byte, error)
LastN will retrieve the last N entries stored at the requested datasource ID return data is an array of JSON objects of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tsc TSStore) Latest(dataSourceID string) ([]byte, error)
Latest will retrieve the last entry stored at the requested datasource ID return data is a JSON object of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tsc TSStore) Length(dataSourceID string) (int, error)
Length retruns the number of records stored for that dataSourceID
func (tsc TSStore) Observe(dataSourceID string) (<-chan ObserveResponse, error)
func (tsc TSStore) Range(dataSourceID string, formTimeStamp int64, toTimeStamp int64, opt TimeSeriesQueryOptions) ([]byte, error)
Range will retrieve all entries between formTimeStamp and toTimeStamp timestamp in ms since unix epoch return data is a JSON object of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tsc TSStore) Since(dataSourceID string, sinceTimeStamp int64, opt TimeSeriesQueryOptions) ([]byte, error)
Since will retrieve all entries since the requested timestamp (ms since unix epoch) return data is a JSON object of the format {"timestamp":213123123,"data":[data-written-by-driver]}
func (tsc TSStore) Write(dataSourceID string, payload []byte) error
Write will add data to the times series data store. Data will be time stamped at insertion (format ms since 1970)
func (tsc TSStore) WriteAt(dataSourceID string, timstamp int64, payload []byte) error
WriteAt will add data to the times series data store. Data will be time stamped with the timstamp provided in the timstamp paramiter (format ms since 1970)
type TimeSeriesQueryOptions struct {
AggregationFunction AggregationType
Filter *Filter
}
TimeSeriesQueryOptions describes the query options for the structured json API
EP/N028260/1, Databox: Privacy-Aware Infrastructure for Managing Personal Data
EP/N028260/2, Databox: Privacy-Aware Infrastructure for Managing Personal Data
EP/N014243/1, Future Everyday Interaction with the Autonomous Internet of Things
EP/M001636/1, Privacy-by-Design: Building Accountability into the Internet of Things EP/M02315X/1, From Human Data to Personal Experience