token

package
v0.0.0-...-c5655c4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadToken

type DownloadToken struct {
	// RemoteBaseBlobID identifies the blob on the sending side on which
	// the diff will be based.  This doesn't change the receiving side's
	// behavior but the sending side needs to know this value to generate
	// the diff.
	RemoteBaseBlobID blob.ID

	// RemoteTargetBlobID identifies the blob on the sending side which
	// will be the target of the diff.  This doesn't change the receiving
	// side's behavior but the sending side needs to know this value to
	// generate the diff.
	RemoteTargetBlobID blob.ID

	// ExpirationTime lets data layer reject stale downloads cheaply.
	ExpirationTime time.Time
}

DownloadToken contains parameters which all the download of a single blob diff which can be applied onto a pre-negotiated blob on the local data layer to create a blob which contains the data for a particular pre-negotiated snapshot.

func NewDownloadToken

func NewDownloadToken(
	base,
	target blob.ID,
	expiresInSecond time.Duration,
) DownloadToken

NewDownloadToken returns a new upload token

type Key

type Key string

Key is a network transferable version of a token; it has two parts: 1. Data server's IP address or name 2. Encrypted UploadToken/DownloadToken

func (Key) String

func (k Key) String() string

String ...

type Server

type Server string

Server is data server's name or IP that a client connects to

func (Server) String

func (s Server) String() string

String ...

type Type

type Type int

Type represents the token type.

const (
	// Upload represents upload token.
	Upload Type = iota
	// Download represents download token.
	Download
)

type UploadToken

type UploadToken struct {
	// VolumeSetID is the volume set ID the blob belongs to
	VolSetID volumeset.ID

	// SnapshotID is the snapshot ID the blob belongs to
	SnapshotID snapshot.ID

	// BaseBlobID identifies the blob on the receiving side
	// where the diff can be applied.  This doesn't change the sending
	// side's behavior but the receiving side needs to know which blob to
	// apply the diff to.
	BaseBlobID blob.ID

	// ExpirationTime lets data layer reject stale uploads cheaply (without
	// talking to data plane, without actually accepting the blob diff).
	// An optimization / some minor protection against a DoS.
	//
	// Data layer and data plane should have sync'd clocks.
	ExpirationTime time.Time
}

UploadToken contains parameters which allow the upload of a single blob diff which can be applied onto a pre-negotiated blob on a particular remote data layer server to create a blob which contains the data for a particular pre-negotiated snapshot. Note: The fields are exported because it is need for GOB encoding/decoding

func NewUploadToken

func NewUploadToken(
	vsid volumeset.ID,
	ssid snapshot.ID,
	b blob.ID,
	expiresInSecond time.Duration,
) UploadToken

NewUploadToken returns a new upload token

Jump to

Keyboard shortcuts

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