Help us shape the future of Go! Take the 2026 Go Developer Survey

warehouse_cache

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package warehouse_cache maintains a process-wide cache of warehouses known to reject the legacy Thrift protocol.

A Reyden / Real-Time SQL warehouse rejects a Thrift OpenSession — the SQL Gateway proxy stamps SQLSTATE KP001 on the rejection. When the driver auto-recovers by re-opening on the kernel backend, it records the warehouse here so later connections to the same warehouse skip the doomed Thrift attempt and open on the kernel directly.

Keyed by (host, warehouse_id) — the host is part of the key so the same warehouse id observed on two different workspaces never collides. Entries expire after TTLSeconds so a warehouse later reconfigured to accept Thrift is eventually retried.

Index

Constants

View Source
const (
	// TTLSeconds controls how long a cached Reyden warehouse entry remains valid.
	// Matches the ADBC driver's 6-hour horizon.
	TTLSeconds = 6 * 60 * 60
)

Variables

This section is empty.

Functions

func ClearCache

func ClearCache()

ClearCache resets the global cache. Intended for tests.

func ExtractWarehouseID

func ExtractWarehouseID(httpPath string) string

ExtractWarehouseID returns the warehouse/endpoint id embedded in httpPath, or empty string.

func IsKnownReyden

func IsKnownReyden(host, warehouseID string) bool

IsKnownReyden returns whether warehouseID on host is known to reject Thrift.

func MarkReyden

func MarkReyden(host, warehouseID string)

MarkReyden records that warehouseID on host rejects the Thrift protocol.

Types

type Cache

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

Cache is a thread-safe cache of warehouses known to reject Thrift.

func NewCache

func NewCache() *Cache

NewCache returns a new thread-safe cache.

func (*Cache) Clear

func (c *Cache) Clear()

Clear resets the cache. Intended for tests.

func (*Cache) IsKnownReyden

func (c *Cache) IsKnownReyden(host, warehouseID string) bool

IsKnownReyden returns whether warehouseID on host is known (unexpired) to reject Thrift.

func (*Cache) MarkReyden

func (c *Cache) MarkReyden(host, warehouseID string)

MarkReyden records that warehouseID on host rejects the Thrift protocol. Performs opportunistic sweep of expired entries.

Jump to

Keyboard shortcuts

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