Documentation ¶
Index ¶
- type Client
- func (c Client) CompareAndSwapWithTTL(key string, old, new int64, ttl time.Duration) (isSet bool, err error)
- func (c Client) GetWithTime(key string) (value int64, storeTime time.Time, err error)
- func (c Client) SetIfNotExistsWithTTL(key string, value int64, ttl time.Duration) (isSet bool, err error)
- type CompareAndSwapWithTTLRequest
- type GetWithTimeResponse
- type IsSetResponse
- type SetIfNotExistsWithTTLRequest
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
GetWithTime retrieves value and store time by making a HTTP GET 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.