httpGCRAStore

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2017 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v0.5.2

type Client struct {
	*apiClient.Client
}

Client is HTTP implementation of gcrastore.Service.

func NewClient added in v0.5.2

func NewClient(c *apiClient.Client) *Client

NewClient initializes a new Client with optional API Client. If API Client is nil a default apiClient is used.

func (Client) CompareAndSwapWithTTL added in v0.5.2

func (c Client) CompareAndSwapWithTTL(key string, old, new int64, ttl time.Duration) (isSet bool, err error)

CompareAndSwapWithTTL sends old and new value and TTL by making a HTTP PUT request to {Client.Endpoint}/keys/{key}.

func (Client) GetWithTime added in v0.5.2

func (c Client) GetWithTime(key string) (value int64, storeTime time.Time, err error)

GetWithTime retrieves value and store time by making a HTTP GET request to {Client.Endpoint}/keys/{key}.

func (Client) SetIfNotExistsWithTTL added in v0.5.2

func (c Client) SetIfNotExistsWithTTL(key string, value int64, ttl time.Duration) (isSet bool, err error)

SetIfNotExistsWithTTL sends value and TTL by making a HTTP POST request to {Client.Endpoint}/keys/{key}.

type CompareAndSwapWithTTLRequest

type CompareAndSwapWithTTLRequest struct {
	Old int64         `json:"old"`
	New int64         `json:"new"`
	TTL time.Duration `json:"ttl"`
}

CompareAndSwapWithTTLRequest holds information sent in CompareAndSwapWithTTL method.

type GetWithTimeResponse

type GetWithTimeResponse struct {
	Value     int64     `json:"value"`
	StoreTime time.Time `json:"store-time"`
}

GetWithTimeResponse holds information that is returned by GetWithTime API endpoint.

type IsSetResponse

type IsSetResponse struct {
	IsSet bool `json:"is-set"`
}

IsSetResponse holds response information from SetIfNotExistsWithTTL and CompareAndSwapWithTTL methods.

type SetIfNotExistsWithTTLRequest

type SetIfNotExistsWithTTLRequest struct {
	Value int64         `json:"value"`
	TTL   time.Duration `json:"ttl"`
}

SetIfNotExistsWithTTLRequest holds information sent in SetIfNotExistsWithTTL method.

Jump to

Keyboard shortcuts

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