mdcache

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package mdcache contains a Cache that caches source metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

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

Cache caches source metadata. Note that the accessor methods return the actual internal cache values, not copies, so the caller MUST NOT modify the returned values.

func New

func New(log *slog.Logger, coll *source.Collection, grips *driver.Grips) *Cache

New returns a new Cache. If log is non-nil, it will be used for logging cache events.

func (*Cache) Close

func (c *Cache) Close() error

Close closes the cache.

func (*Cache) DBProperties

func (c *Cache) DBProperties(ctx context.Context, handle string) (map[string]any, error)

DBProperties returns the DB properties for the source. The returned value is the internal cache entry, so the caller MUST NOT modify it.

func (*Cache) DBPropertiesPair

func (c *Cache) DBPropertiesPair(ctx context.Context,
	src1, src2 *source.Source,
) (dbp1, dbp2 map[string]any, err error)

DBPropertiesPair returns the DB properties for src1 and src2. The returned values are the internal cache entries, so the caller MUST NOT modify them.

func (*Cache) SourceMeta

func (c *Cache) SourceMeta(ctx context.Context, handle string) (*metadata.Source, error)

SourceMeta returns the metadata for the source. The returned value is the internal cache entry, so the caller MUST NOT modify it. Use metadata.Source.Clone if necessary.

func (*Cache) SourceMetaPair

func (c *Cache) SourceMetaPair(ctx context.Context, src1, src2 *source.Source) (md1, md2 *metadata.Source, err error)

SourceMetaPair returns the metadata.Source pair for tbl1 and tbl2. The returned values are the internal cache entries, so the caller MUST NOT modify them. Use metadata.Source.Clone if necessary.

func (*Cache) TableMeta

func (c *Cache) TableMeta(ctx context.Context, tbl source.Table) (*metadata.Table, error)

TableMeta returns the metadata for tbl. The returned value is the internal cache entry, so the caller MUST NOT modify it. Use metadata.Table.Clone if necessary.

func (*Cache) TableMetaPair

func (c *Cache) TableMetaPair(ctx context.Context, tbl1, tbl2 source.Table) (md1, md2 *metadata.Table, err error)

TableMetaPair returns the metadata.Table pair for tbl1 and tbl2. The returned values are the internal cache entries, so the caller MUST NOT modify them. Use metadata.Table.Clone if necessary.

func (*Cache) TableNames

func (c *Cache) TableNames(ctx context.Context, handle string) ([]string, error)

TableNames returns the table names for the source. The returned value is the internal cache entry, so the caller MUST NOT modify it.

func (*Cache) TableNamesPair

func (c *Cache) TableNamesPair(ctx context.Context, src1, src2 *source.Source) (tbls1, tbls2 []string, err error)

TableNamesPair returns the list of tables for tbl1 and tbl2. The returned values are the internal cache entries, so the caller MUST NOT modify them.

Jump to

Keyboard shortcuts

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