vault

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {
	VaultClient Client
	CachePaths  map[string]CachePath
	CacheDatas  map[string]CacheData
}

Cache - the interface

func NewCache

func NewCache(client Client) *Cache

NewCache - Create a new caching instance

func (*Cache) CacheDataExist

func (c *Cache) CacheDataExist(path string) bool

CacheDataExist - Check to see if we have the key/value pairs in cache

func (*Cache) CachePathExists

func (c *Cache) CachePathExists(path string) bool

CachePathExists - Check for the existance of a path in cache

func (*Cache) GetCacheData

func (c *Cache) GetCacheData(path string) DataRecord

GetCacheData - Fetch the key/value data

func (*Cache) PreloadFolderPaths

func (c *Cache) PreloadFolderPaths(folderPath string) error

PreloadFolderPaths - called as a goroutine for each of the Folders at the current level.

func (*Cache) PreloadPaths

func (c *Cache) PreloadPaths(paths map[string]Paths) error

PreloadPaths - called as a goroutine to pre-populate key/values for each KEY item

func (*Cache) UpdateCacheData

func (c *Cache) UpdateCacheData(path string, data DataRecord) (bool, error)

UpdateCacheData - Add key/value data to the cache

func (*Cache) UpdateCachePath

func (c *Cache) UpdateCachePath(path string, paths map[string]Paths) (bool, error)

UpdateCachePath - Add a path item to the cache list

type CacheData

type CacheData struct {
	CacheTime time.Time
	Data      DataRecord
}

CacheData - key/value data cache

type CachePath

type CachePath struct {
	CacheTime time.Time
	Paths     map[string]Paths
}

CachePath - hold items read in cache

type Client

type Client interface {
	GetVersion() (string, error)
	GetData(path string) (DataRecord, error)
	GetPaths(path string) (map[string]Paths, error)
}

Client - Our primary client interface

func NewVault

func NewVault() Client

NewVault - Create a new Vault API Interface

func NewVaultMock

func NewVaultMock() Client

NewVaultMock - Mocking the vault interactions

type DataRecord

type DataRecord struct {
	Data struct {
		Data     map[string]interface{} `json:"data"`
		Metadata struct {
			CreatedTime  string `json:"created_time"`
			DeletionTime string `json:"deletion_time"`
			Destroyed    bool   `json:"destroyed"`
			Version      int    `json:"version"`
		} `json:"metadata"`
	} `json:"data"`
}

DataRecord - base vault record structure

type Paths

type Paths struct {
	Type     string
	Path     string
	Version  int
	Parent   string
	FullPath string
}

Paths - Vault Path Data

Jump to

Keyboard shortcuts

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