Documentation ¶
Overview ¶
Package qldbdriver is the Golang driver for working with Amazon Quantum Ledger Database.
Index ¶
- type BackoffStrategy
- type BufferedResult
- type DriverOptions
- type ExponentialBackoffStrategy
- type IOUsage
- type LogLevel
- type Logger
- type QLDBDriver
- func (driver *QLDBDriver) Execute(ctx context.Context, fn func(txn Transaction) (interface{}, error)) (interface{}, error)
- func (driver *QLDBDriver) GetTableNames(ctx context.Context) ([]string, error)
- func (driver *QLDBDriver) SetRetryPolicy(rp RetryPolicy)
- func (driver *QLDBDriver) Shutdown(ctx context.Context)
- type Result
- type RetryPolicy
- type TimingInformation
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackoffStrategy ¶
type BackoffStrategy interface { // Get the time to delay before retrying, using an exponential function on the retry attempt, and jitter. Delay(retryAttempt int) time.Duration }
BackoffStrategy is an interface for implementing a delay before retrying the provided function with a new transaction.
type BufferedResult ¶
type BufferedResult interface { Next() bool GetCurrentData() []byte GetConsumedIOs() *IOUsage GetTimingInformation() *TimingInformation }
BufferedResult is a cursor over a result set from a QLDB statement that is valid outside the context of a transaction.
type DriverOptions ¶
type DriverOptions struct { // The policy guiding retry attempts upon a recoverable error. // Default: MaxRetryLimit: 4, ExponentialBackoff: SleepBase: 10ms, SleepCap: 5000ms. RetryPolicy RetryPolicy // The maximum amount of concurrent transactions this driver will permit. Default: 50. MaxConcurrentTransactions int // The logger that the driver will use for any logging messages. Default: "log" package. Logger Logger // The verbosity level of the logs that the logger should receive. Default: qldbdriver.LogInfo. LoggerVerbosity LogLevel }
DriverOptions can be used to configure the driver during construction.
type ExponentialBackoffStrategy ¶
type ExponentialBackoffStrategy struct { // The time in milliseconds to use as the exponent base for the delay calculation. SleepBase time.Duration // The maximum delay time in milliseconds. SleepCap time.Duration }
ExponentialBackoffStrategy exponentially increases the delay per retry attempt given a base and a cap.
This is the default strategy implementation.
type IOUsage ¶
type IOUsage struct {
// contains filtered or unexported fields
}
IOUsage contains metrics for the amount of IO requests that were consumed.
func (*IOUsage) GetReadIOs ¶
GetReadIOs returns the number of read IO requests that were consumed for a statement execution.
type Logger ¶
type Logger interface { // Log the message using the built-in Golang logging package. Log(message string, verbosity LogLevel) }
Logger is an interface for a QLDBDriver logger.
type QLDBDriver ¶
type QLDBDriver struct {
// contains filtered or unexported fields
}
QLDBDriver is used to execute statements against QLDB. Call constructor qldbdriver.New for a valid QLDBDriver.
func New ¶
func New(ledgerName string, qldbSession *qldbsession.Client, fns ...func(*DriverOptions)) (*QLDBDriver, error)
New creates a QLBDDriver using the parameters and options, and verifies the configuration.
Note that qldbSession will disable all SDK retry attempts when calling service operations. DriverOptions.RetryLimit is unrelated to SDK retries, but should be used if it is desired to modify the amount of retires for statement executions.
func (*QLDBDriver) Execute ¶
func (driver *QLDBDriver) Execute(ctx context.Context, fn func(txn Transaction) (interface{}, error)) (interface{}, error)
Execute a provided function within the context of a new QLDB transaction.
The provided function might be executed more than once and is not expected to run concurrently. It is recommended for it to be idempotent, so that it doesn't have unintended side effects in the case of retries.
func (*QLDBDriver) GetTableNames ¶
func (driver *QLDBDriver) GetTableNames(ctx context.Context) ([]string, error)
GetTableNames returns a list of the names of active tables in the ledger.
func (*QLDBDriver) SetRetryPolicy ¶
func (driver *QLDBDriver) SetRetryPolicy(rp RetryPolicy)
SetRetryPolicy sets the driver's retry policy for Execute.
func (*QLDBDriver) Shutdown ¶
func (driver *QLDBDriver) Shutdown(ctx context.Context)
Shutdown the driver, cleaning up allocated resources.
type Result ¶
type Result interface { Next(txn Transaction) bool GetCurrentData() []byte GetConsumedIOs() *IOUsage GetTimingInformation() *TimingInformation Err() error }
Result is a cursor over a result set from a QLDB statement.
type RetryPolicy ¶
type RetryPolicy struct { // The maximum amount of times to retry. MaxRetryLimit int // The strategy to use for delaying before the retry attempt. Backoff BackoffStrategy }
RetryPolicy defines the policy to use to for retrying the provided function in the case of a non-fatal error.
type TimingInformation ¶
type TimingInformation struct {
// contains filtered or unexported fields
}
TimingInformation contains metrics for server-side processing time.
func (*TimingInformation) GetProcessingTimeMilliseconds ¶
func (timingInfo *TimingInformation) GetProcessingTimeMilliseconds() *int64
GetProcessingTimeMilliseconds returns the server-side processing time in milliseconds for a statement execution.
type Transaction ¶
type Transaction interface { // Execute a statement with any parameters within this transaction. Execute(statement string, parameters ...interface{}) (Result, error) // Buffer a Result into a BufferedResult to use outside the context of this transaction. BufferResult(res Result) (BufferedResult, error) // Abort the transaction, discarding any previous statement executions within this transaction. Abort() error // Return the automatically generated transaction ID. ID() string }
Transaction represents an active QLDB transaction.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package qldbsessioniface provides an interface to enable mocking the Amazon QLDB Session service client for testing your code.
|
Package qldbsessioniface provides an interface to enable mocking the Amazon QLDB Session service client for testing your code. |