Documentation
¶
Overview ¶
Package cache consists of all caching relted functions and data structures.
Copyright 2021 Michael Bungenstock ¶
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.
Package cache consists of all caching relted functions and data structures.
Copyright 2021 Michael Bungenstock ¶
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.
Package cache consists of all caching relted functions and data structures.
Copyright 2021 Michael Bungenstock ¶
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.
Package cache consists of all caching relted functions and data structures.
Copyright 2021 Michael Bungenstock ¶
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.
Package cache consists of all caching relted functions and data structures.
Copyright 2021 Michael Bungenstock ¶
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.
Package helper consists of helping functions.
Copyright 2021 Michael Bungenstock ¶
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.
Package cache consists of all caching relted functions and data structures.
Copyright 2021 Michael Bungenstock ¶
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.
Package cache consists of all caching relted functions and data structures.
Copyright 2021 Michael Bungenstock ¶
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 ¶
- type APICall
- type AutoContainer
- type CachedAPICall
- type ContainerCall
- type EatByList
- type EatByMap
- type ListFileCache
- type MapFileCache
- func NewContainerCache(auth *api.AuthenticationConfig, pp util.PathProvider) *MapFileCache
- func NewMapFileCache(apiCall APICall, trans *TransformMap, d time.Duration, file util.Path) *MapFileCache
- func NewODNameToID(ac *AutoContainer, name, schema string, pp util.PathProvider) *MapFileCache
- func NewODNameToInstanceID(ac *AutoContainer, name, schema string, pp util.PathProvider) *MapFileCache
- type MapMemCache
- type ODCall
- type SandboxCall
- type TransformList
- type TransformMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APICall ¶
type APICall interface {
Call() (interface{}, error)
}
APICall is a simple interface for all simplified REST API calls
func NewCachedAPICall ¶
NewCachedAPICall creates an initialized CachedAPICall object
func NewContainerCall ¶
func NewContainerCall(auth *api.AuthenticationConfig) APICall
NewContainerCall creates an initialized ContainerCall object
func NewODCall ¶
func NewODCall(ac *AutoContainer, schema string) APICall
NewODCall creates an initialized ODCall object
func NewSandboxCall ¶
func NewSandboxCall(auth *api.AuthenticationConfig) APICall
NewSandboxCall creates an initialized SandboxCall object
type AutoContainer ¶
type AutoContainer struct { ContainerID string Auth *api.AuthenticationConfig // contains filtered or unexported fields }
AutoContainer resolves autmatically the container id
func NewAutoContainer ¶
func NewAutoContainer(auth *api.AuthenticationConfig, pp util.PathProvider) *AutoContainer
func (*AutoContainer) AddContainerFlag ¶
func (a *AutoContainer) AddContainerFlag(cmd *cobra.Command) error
AddContainerFlag adds the required container flags to the passed command
func (*AutoContainer) Get ¶
func (a *AutoContainer) Get() (string, error)
Get retrieves the container id
type CachedAPICall ¶
type CachedAPICall struct {
// contains filtered or unexported fields
}
CachedAPICall just stores a copy of the response if call was successful. Implements APICall interface.
func (*CachedAPICall) Call ¶
func (c *CachedAPICall) Call() (interface{}, error)
Call is the entry point
type ContainerCall ¶
type ContainerCall struct {
// contains filtered or unexported fields
}
ContainerCall encapsulates the call of the container service
func (*ContainerCall) Call ¶
func (c *ContainerCall) Call() (interface{}, error)
Call is the entry point
type ListFileCache ¶
type ListFileCache struct { API APICall Duration time.Duration // contains filtered or unexported fields }
func NewListFileCache ¶
func NewListFileCache(apiCall APICall, trans *TransformList, d time.Duration, file util.Path) *ListFileCache
func NewSandboxCache ¶
func NewSandboxCache(auth *api.AuthenticationConfig, pp util.PathProvider) *ListFileCache
NewSandboxCache creates an initilzed ListFileCache object for lists of sandboxes
func (*ListFileCache) Delete ¶
func (c *ListFileCache) Delete() error
Delete deletes the corresponding file
func (*ListFileCache) Values ¶
func (c *ListFileCache) Values() []string
type MapFileCache ¶
type MapFileCache struct { API APICall Duration time.Duration // contains filtered or unexported fields }
MapFileCache is a file cache for maps
func NewContainerCache ¶
func NewContainerCache(auth *api.AuthenticationConfig, pp util.PathProvider) *MapFileCache
NewContainerCache creates a new container cache
func NewMapFileCache ¶
func NewMapFileCache(apiCall APICall, trans *TransformMap, d time.Duration, file util.Path) *MapFileCache
NewMapFileCache creates an intialized MapFileCache object
func NewODNameToID ¶
func NewODNameToID(ac *AutoContainer, name, schema string, pp util.PathProvider) *MapFileCache
NewODNameToID creates an initialzed MapFileCache object with a xdm:name -> @id
func NewODNameToInstanceID ¶
func NewODNameToInstanceID(ac *AutoContainer, name, schema string, pp util.PathProvider) *MapFileCache
NewODNameToInstanceID creates an initialzed MapFileCache object with a xdm:name -> instanceId
func (*MapFileCache) Delete ¶
func (c *MapFileCache) Delete()
DeleteE deletes the corresponding file
func (*MapFileCache) DeleteE ¶
func (c *MapFileCache) DeleteE() error
DeleteE deletes the corresponding file
func (*MapFileCache) Keys ¶
func (c *MapFileCache) Keys() []string
Keys returns all keys from the map
func (*MapFileCache) Lookup ¶
func (c *MapFileCache) Lookup(key string) string
Lookup returns either the related value or the key itself
func (*MapFileCache) LookupE ¶
func (c *MapFileCache) LookupE(key string) (string, error)
LookupE returns either the related value or an error
func (*MapFileCache) Values ¶
func (c *MapFileCache) Values() []string
Values returns all values from the map
type MapMemCache ¶
type MapMemCache struct { API APICall // contains filtered or unexported fields }
MapMemCache stores a mapper object im memory
func NewMapMemCache ¶
func NewMapMemCache(apiCall APICall, trans *TransformMap) *MapMemCache
NewMapMemCache creates an initialized MapMemCache object
func NewODNameToIDMem ¶
func NewODNameToIDMem(ac *AutoContainer, schema string) *MapMemCache
NewODNameToIDMem creates an initialzed MemCache object with a xdm:name -> @id
func NewODNameToInstanceIDMem ¶
func NewODNameToInstanceIDMem(ac *AutoContainer, schema string) *MapMemCache
NewODNameToIDMem creates an initialzed MemCache object with a xdm:name -> instanceId
func (*MapMemCache) Lookup ¶
func (c *MapMemCache) Lookup(key string) string
LookupE returns either the related value or the key
func (*MapMemCache) LookupE ¶
func (c *MapMemCache) LookupE(key string) (string, error)
LookupE returns either the related value or an error
func (*MapMemCache) Mapper ¶ added in v0.3.0
func (c *MapMemCache) Mapper() util.Mapper
func (*MapMemCache) Values ¶
func (c *MapMemCache) Values() []string
Values returns all values from the map
type ODCall ¶
type ODCall struct {
// contains filtered or unexported fields
}
ODCall is a generic encapsulation for all offer decisioning calls
type SandboxCall ¶
type SandboxCall struct {
// contains filtered or unexported fields
}
SandboxCall encapsulates the sandbox list call
func (*SandboxCall) Call ¶
func (c *SandboxCall) Call() (interface{}, error)
Call is the entry point
type TransformList ¶
TransformList transforms a JSON response to a list
func NewTransformList ¶
func NewTransformList(p ...string) *TransformList
NewTransformList creates an initialized TransformList object
func (*TransformList) P ¶
func (c *TransformList) P(p ...string) *TransformList
P provides the path to the rangable list inside the JSON file
func (TransformList) Transform ¶
func (c TransformList) Transform(obj interface{}) []string
Transform transforms the passed ojbect to an array of strings
func (*TransformList) V ¶
func (c *TransformList) V(v ...string) *TransformList
V provides the path to the value
type TransformMap ¶
TransformMap transforms a JSON response to a mapper
func NewODTrans ¶
func NewODTrans() *TransformMap
NewODTrans returns a transformation with the right path for offer decisionsing HAL responses
func NewTransformMap ¶
func NewTransformMap(p ...string) *TransformMap
NewTransformMap creates an initialzed TransformMap object
func ODNameToID ¶
func ODNameToID() *TransformMap
ODNameToID returns a transformation xdm:name -> @id
func ODNameToInstanceID ¶
func ODNameToInstanceID() *TransformMap
ODNameToID returns a transformation xdm:name -> instanceId
func (*TransformMap) K ¶
func (c *TransformMap) K(k ...string) *TransformMap
K provides the path to the key
func (*TransformMap) P ¶
func (c *TransformMap) P(p ...string) *TransformMap
P provides the path to the rangable list inside the JSON file
func (TransformMap) Transform ¶
func (c TransformMap) Transform(obj interface{}) util.Mapper
Transform transforms the passed ojbect to a mapper
func (*TransformMap) V ¶
func (c *TransformMap) V(v ...string) *TransformMap
V provides the path to the value