pgstorage

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const LockId = "selefra-fetch-lock"
View Source
const SchemaOwnerKey = "schema-owner-key"

Variables

This section is empty.

Functions

func BuildCacheKey

func BuildCacheKey(tableName string) string

func DefaultPostgreSQL added in v0.0.10

func DefaultPostgreSQL(downloadWorkspace string, messageChannel *message.Channel[*schema.Diagnostics]) string

DefaultPostgreSQL 1. If the default Postgresql is not installed, install it 2. If the default Postgresql is not started, start it 3. Return the default Postgresql DSN connection

func GetSchemaKey

func GetSchemaKey(providerName, providerVersion string, providerConfigurationBlock *module.ProviderBlock) string

GetSchemaKey return provider schema named <required.name>_<required_version>_<provider_name>

func GetStorageValue

func GetStorageValue(ctx context.Context, storage *postgresql_storage.PostgresqlStorage, key string) (string, error)

func SaveSchemaOwner

func SaveSchemaOwner(ctx context.Context, storage storage.Storage, owner *SchemaOwnerInformation) *schema.Diagnostics

func SaveTableCacheInformation

func SaveTableCacheInformation(ctx context.Context, storage storage.Storage, information *TableCacheInformation) *schema.Diagnostics

SaveTableCacheInformation Save the table cache information to the kv database

func SetStorageValue

func SetStorageValue(ctx context.Context, storage *postgresql_storage.PostgresqlStorage, key, value string) error

Types

type Option

type Option func(pgopts *postgresql_storage.PostgresqlStorageOptions)

func WithSearchPath

func WithSearchPath(searchPath string) Option

type SchemaOwnerInformation

type SchemaOwnerInformation struct {

	// The host name of the holder
	Hostname string `json:"hostname"`

	// Holder's ID
	HolderID string `json:"holder_id"`

	// The name of the holder's configuration file
	ConfigurationName string `json:"configuration_name"`

	// MD5 configured when pulling data from this schema
	ConfigurationMD5 string `json:"configuration_md5"`
}

SchemaOwnerInformation schema is held by whom, information about the holder

type TableCacheInformation

type TableCacheInformation struct {

	// Table name
	TableName string `json:"table_name"`

	// The last time this table was pulled
	LastPullTime time.Time `json:"last_pull_time"`

	// Which batch was pulled off
	LastPullId string `json:"last_pull_id"`
}

TableCacheInformation Some information about the table level cache

func ReadTableCacheInformation

func ReadTableCacheInformation(ctx context.Context, storage storage.Storage, tableName string) (*TableCacheInformation, *schema.Diagnostics)

ReadTableCacheInformation Reads the table cache information from the database

Jump to

Keyboard shortcuts

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