Documentation ¶
Index ¶
Constants ¶
const ( // PublicIP is the value for public IP connections. PublicIP = "PUBLIC" // PrivateIP is the value for private IP connections. PrivateIP = "PRIVATE" // PSC designates PSC-based connections. PSC = "PSC" )
const ( // RefreshTimeout is the maximum amount of time to wait for a refresh // cycle to complete. This value should be greater than the // refreshInterval. RefreshTimeout = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionInfo ¶ added in v1.9.0
type ConnectionInfo struct { IPAddrs map[string]string ClientCert tls.Certificate RootCAs *x509.CertPool Expiration time.Time }
ConnectionInfo holds all the data necessary to connect to an instance.
type InstanceURI ¶ added in v1.2.2
type InstanceURI struct {
// contains filtered or unexported fields
}
InstanceURI represents an AlloyDB instance.
func ParseInstURI ¶ added in v1.2.2
func ParseInstURI(cn string) (InstanceURI, error)
ParseInstURI initializes a new InstanceURI struct.
func (*InstanceURI) String ¶ added in v1.2.2
func (i *InstanceURI) String() string
type RefreshAheadCache ¶ added in v1.9.0
type RefreshAheadCache struct {
// contains filtered or unexported fields
}
RefreshAheadCache manages the information used to connect to the AlloyDB instance by periodically calling the AlloyDB Admin API. It automatically refreshes the required information approximately 4 minutes before the previous certificate expires (every ~56 minutes).
func NewRefreshAheadCache ¶ added in v1.9.0
func NewRefreshAheadCache( instance InstanceURI, l debug.Logger, client *alloydbadmin.AlloyDBAdminClient, key *rsa.PrivateKey, refreshTimeout time.Duration, dialerID string, ) *RefreshAheadCache
NewRefreshAheadCache initializes a new cache that proactively refreshes the caches connection info.
func (*RefreshAheadCache) Close ¶ added in v1.9.0
func (i *RefreshAheadCache) Close() error
Close closes the instance; it stops the refresh cycle and prevents it from making additional calls to the AlloyDB Admin API.
func (*RefreshAheadCache) ConnectionInfo ¶ added in v1.9.0
func (i *RefreshAheadCache) ConnectionInfo(ctx context.Context) (ConnectionInfo, error)
ConnectionInfo returns an IP address specified by ipType (i.e., public or private) of the AlloyDB instance.
func (*RefreshAheadCache) ForceRefresh ¶ added in v1.9.0
func (i *RefreshAheadCache) ForceRefresh()
ForceRefresh triggers an immediate refresh operation to be scheduled and used for future connection attempts if valid.
func (*RefreshAheadCache) OpenConns ¶ added in v1.9.0
func (i *RefreshAheadCache) OpenConns() *uint64
OpenConns reports the number of open connections.