ociretry

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ociretry implements OCI opc-retry-token replay bookkeeping.

Index

Constants

View Source
const TTL = 24 * time.Hour

TTL is how long a token is remembered; the OCI SDK documents that retry tokens expire after 24 hours.

Variables

This section is empty.

Functions

func Join

func Join(id, workRequest string) string

Join packs a resource id and a work request id into one value.

func Split

func Split(v string) (string, string)

Split reverses Join.

Types

type Entry

type Entry struct {
	At    time.Time `json:"at"`
	Value string    `json:"value"`
}

Entry is a remembered create result.

type Store

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

Store maps scope|token to the first result. It has no lock: callers hold their backend lock.

func New

func New() *Store

New returns an empty store.

func (*Store) Entries

func (s *Store) Entries() map[string]Entry

Entries returns the stored entries for a snapshot.

func (*Store) Load

func (s *Store) Load(m map[string]Entry)

Load replaces the contents with a snapshot's entries.

func (*Store) Lookup

func (s *Store) Lookup(scope, token string, now time.Time) (string, bool)

Lookup returns the value remembered for the token if it has not expired.

func (*Store) Once

func (s *Store) Once(
	scope, token string, now time.Time, replay func(value string) error, create func() (string, error),
) error

Once answers a replayed token through replay, or runs create and remembers its value. The caller holds its backend write lock across the whole call so concurrent identical requests create once.

func (*Store) Remember

func (s *Store) Remember(scope, token, value string, now time.Time)

Remember records the result of the first request that carried the token.

func (*Store) Reset

func (s *Store) Reset()

Reset empties the store.

Jump to

Keyboard shortcuts

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