storage

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright Yahoo 2021 Licensed under the terms of the Apache License 2.0. See LICENSE file in project root for terms.

Copyright Yahoo 2021 Licensed under the terms of the Apache License 2.0. See LICENSE file in project root for terms.

Copyright Yahoo 2021 Licensed under the terms of the Apache License 2.0. See LICENSE file in project root for terms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnPoolMgr

type ConnPoolMgr interface {
	SetMaxOpenConns(n int)
	SetMaxIdleConns(n int)
	SetConnMaxLifetime(d time.Duration)
	SetConnMaxIdleTime(d time.Duration)
}

ConnPoolMgr manages a RDBMS connection pool. The methods are defined on sql.DB. Ref. https://golang.org/pkg/database/sql/

type CredentialsCreator

type CredentialsCreator interface {
	Create(rdsconfig.IAMAuthConfig) (*credentials.Credentials, error)
}

CredentialsCreator can be implemented to create Credentials based on different types of providers. Fields of IAMAuthConfig can be updated to incorporate such changes in the future.

type GrafeasStorageProvider

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

GrafeasStorageProvider contains the fields to flexibily create a storage.Storage.

func NewGrafeasStorageProvider

func NewGrafeasStorageProvider(drv driver.Driver, credentialsCreator CredentialsCreator, storageCreator StorageCreator) *GrafeasStorageProvider

NewGrafeasStorageProvider returns a StorageProvider whose fields are populated with the arguments.

func (GrafeasStorageProvider) Provide

Provide returns a storage which is configured based on the receiver's fields.

func (GrafeasStorageProvider) ProvideRW added in v0.0.2

ProvideRW returns a storage which is configured based on the receiver's fields. The storage connects to different reader/writer. If no reader is provided, then it will only connect to the writer.

type Storage

type Storage interface {
	storage.Gs
	storage.Ps
	ConnPoolMgr
}

Storage contains all the methods to 1. be used as a backend for a Grafeas server AND 2. manage a RDBMS connection pool.

type StorageCreator

type StorageCreator interface {
	Create(connector driver.Connector, paginationKey string) (Storage, error)
	CreateRW(readerConnector driver.Connector, writerConnector driver.Connector, paginationKey string) (Storage, error)
}

StorageCreator can be implemented based on the backend storage types (e.g. PostgreSQL, MySQL, etc.).

Jump to

Keyboard shortcuts

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