Documentation
¶
Index ¶
- type CompareAndSwapWithTTLRequest
- type GetWithTimeResponse
- type IsSetResponse
- type Service
- func (s Service) CompareAndSwapWithTTL(key string, old, new int64, ttl time.Duration) (isSet bool, err error)
- func (s Service) GetWithTime(key string) (value int64, storeTime time.Time, err error)
- func (s Service) SetIfNotExistsWithTTL(key string, value int64, ttl time.Duration) (isSet bool, err error)
- type SetIfNotExistsWithTTLRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 Service ¶
type Service struct {
// Client provides HTTP request making functionality.
Client *apiClient.Client
}
Service is HTTP implementation of gcrastore.Service.
func NewService ¶
func NewService(c *apiClient.Client) *Service
NewService initializes a new Service with optional API Client. If API Client is nil a default apiClient is used.
func (Service) CompareAndSwapWithTTL ¶
func (s Service) 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 (Service) GetWithTime ¶
GetWithTime retrieves value and store time by making a HTTP GET request to {Client.Endpoint}/keys/{key}.
type SetIfNotExistsWithTTLRequest ¶
type SetIfNotExistsWithTTLRequest struct {
Value int64 `json:"value"`
TTL time.Duration `json:"ttl"`
}
SetIfNotExistsWithTTLRequest holds information sent in SetIfNotExistsWithTTL method.