Documentation ¶
Index ¶
- Constants
- func NewResetRetryHandler(ctx context.Context, getter Getter) (*resetRetryHandler, error)
- func NewVersionedBackupReader(format SerializationFormat, baseReaders ...io.ReadCloser) (io.ReadCloser, error)
- type Getter
- type SerializationFormat
- type SerializationVersion
- type VersionedRestoreReader
Constants ¶
const (
VersionFormatSize = int(unsafe.Sizeof(persistedSerializationVersion(0)))
)
Variables ¶
This section is empty.
Functions ¶
func NewResetRetryHandler ¶
NewResetRetryHandler returns an io.ReadCloser with the reader initialized to the result of getter. The reader is eagerly initialized during this call so if callers of this function want to delay initialization they should wrap this reader in a lazy initializer.
Selected errors that the reader hits during Read calls (e.x. syscall.ECONNRESET) will be automatically retried by the returned reader.
func NewVersionedBackupReader ¶
func NewVersionedBackupReader( format SerializationFormat, baseReaders ...io.ReadCloser, ) (io.ReadCloser, error)
NewVersionedBackupReader creates a reader that injects format into the first bytes of the returned data. After format has been returned, data is returned from baseReaders in the order they're passed in.
Types ¶
type Getter ¶
type Getter interface { // SupportsRange returns true if this Getter supports adding Range headers to // the Get call. Otherwise returns false. SupportsRange() bool // Get attempts to get another reader for the data this reader is returning. // headers denotes any additional headers that should be added to the request, // like a Range header. // // Don't allow passing a URL to Get so that we can hide the fact that some // components may need to dynamically refresh the fetch URL (i.e. OneDrive) // from this wrapper. // // Get should encapsulate all error handling and status code checking required // for the component. This function is called both during NewResetRetryHandler // and Read so it's possible to discover errors with the item prior to // informing other components about it if desired. Get(ctx context.Context, headers map[string]string) (io.ReadCloser, error) }
type SerializationFormat ¶
type SerializationFormat struct { Version SerializationVersion DelInFlight bool }
SerializationFormat is a struct describing serialization format versions and flags to add for this item.
type SerializationVersion ¶
type SerializationVersion uint16
SerializationVersion is the in-memory size of the version number that gets added to the persisted serialization version.
Right now it's only a uint16 but we can expand it to be larger so long as the expanded size doesn't clash with the flags in the high-order bits.
const DefaultSerializationVersion SerializationVersion = 1
DefaultSerializationVersion is the current (default) version number for all services. As services evolve their storage format they should begin tracking their own version numbers separate from other services.
type VersionedRestoreReader ¶
type VersionedRestoreReader struct {
// contains filtered or unexported fields
}
func NewVersionedRestoreReader ¶
func NewVersionedRestoreReader( baseReader io.ReadCloser, ) (*VersionedRestoreReader, error)
NewVersionedRestoreReader wraps baseReader and provides easy access to the SerializationFormat info in the first bytes of the data contained in baseReader.
func (*VersionedRestoreReader) Close ¶
func (vrr *VersionedRestoreReader) Close() error
func (VersionedRestoreReader) Format ¶
func (vrr VersionedRestoreReader) Format() SerializationFormat