Liking cljdoc? Tell your friends :D

konserve-gcs.core


*batch-delete-attempts*clj

How often a key is sent before a retryable failure is reported. Covers both a failed batch request and per-object failures: the client's retry strategy applies to neither, as batch requests bypass it, so this is their only retry.

How often a key is sent before a retryable failure is reported. Covers both a
failed batch request and per-object failures: the client's retry strategy
applies to neither, as batch requests bypass it, so this is their only retry.
sourceraw docstring

*default-bucket*clj

source

*deletion-batch-size*clj

source

*output-stream-buffer-size*clj

source

batch-delete-blobsclj

(batch-delete-blobs submit store-keys)

Delete store-keys with GCS batch requests of at most batch-delete-max-calls calls, returning {:deleted #{...} :failed {k e}}.

submit is submit-delete-batch partially applied: one chunk in, one outcome map out. A deleted object and a missing one both count as deleted. A retryable per-object failure, an unanswered call, and a failed batch request are sent again, up to *batch-delete-attempts* times in all. What still fails then is reported in :failed with its exception, except a batch request that fails on its last attempt, which throws. Every requested key ends up in exactly one category, and none is reported deleted unless GCS said so.

Delete `store-keys` with GCS batch requests of at most
`batch-delete-max-calls` calls, returning {:deleted #{...} :failed {k e}}.

`submit` is `submit-delete-batch` partially applied: one chunk in, one
outcome map out. A deleted object and a missing one both count as deleted.
A retryable per-object failure, an unanswered call, and a failed batch
request are sent again, up to `*batch-delete-attempts*` times in all. What
still fails then is reported in `:failed` with its exception, except a batch
request that fails on its last attempt, which throws. Every requested key
ends up in exactly one category, and none is reported deleted unless GCS
said so.
sourceraw docstring

batch-delete-max-callsclj

Calls per GCS batch request. The JSON API accepts at most 100.

Calls per GCS batch request. The JSON API accepts at most 100.
sourceraw docstring

blob-exists?clj

(blob-exists? client bucket store-path blob-key)
source

blob-idclj

(blob-id bucket blob-store-path)
(blob-id bucket store-path blob-key)
source

cloud-storage-clientclj

(cloud-storage-client {:keys [client] :as spec})

Return the Storage client for spec: the caller's own when the spec carries one under :client, otherwise a shared client for the spec's :project-id and :host (the latter for an emulator endpoint, e.g. 'http://localhost:4443'), built on first use.

Safe to call from many threads and for many stores. Stores never close the client they are given -- neither a shared one nor the caller's. Call shutdown-clients! to close the shared ones, e.g. on process exit; a caller-supplied client is the caller's to close.

Return the Storage client for `spec`: the caller's own when the spec
carries one under :client, otherwise a shared client for the spec's
:project-id and :host (the latter for an emulator endpoint, e.g.
'http://localhost:4443'), built on first use.

Safe to call from many threads and for many stores. Stores never close the
client they are given -- neither a shared one nor the caller's. Call
`shutdown-clients!` to close the shared ones, e.g. on process exit; a
caller-supplied client is the caller's to close.
sourceraw docstring

connect-storeclj

(connect-store spec & {:keys [opts config] :as params})
source

copy-blobclj

(copy-blob client bucket store-path from-blob-key to-blob-key)

Copy blob from one key to another. Returns nil if source doesn't exist.

Copy blob from one key to another. Returns nil if source doesn't exist.
sourceraw docstring

create-bucketclj

(create-bucket client location bucket)
source

delete-blobclj

(delete-blob client bucket store-path blob-key)

Delete blob. Returns true if deleted, false if not found.

Delete blob. Returns true if deleted, false if not found.
sourceraw docstring

delete-many-blobsclj

(delete-many-blobs client bucket blob-store-paths)
source

delete-storeclj

(delete-store spec & {:keys [opts]})
source

get-bucketclj

(get-bucket client bucket-name)
source

list-key-pageclj

(list-key-page client bucket store-path cursor limit)

One page of a store's keys: the same objects -keys lists, at most limit of them, as {:keys [store-key ...] :cursor next-page-token-or-nil}.

One GCS list request. cursor is GCS's page token, nil for the first page. GCS counts objects and folder prefixes together against maxResults, and the folder prefixes and foreign objects are dropped here, so a page may hold fewer keys than limit, or none, and still not be the last.

One page of a store's keys: the same objects `-keys` lists, at most `limit`
of them, as {:keys [store-key ...] :cursor next-page-token-or-nil}.

One GCS list request. `cursor` is GCS's page token, nil for the first page.
GCS counts objects and folder prefixes together against `maxResults`, and
the folder prefixes and foreign objects are dropped here, so a page may hold
fewer keys than `limit`, or none, and still not be the last.
sourceraw docstring

list-objectsclj

(list-objects client bucket store-path)
source

read-blobclj

(read-blob client blob-id)
source

read-blob-with-generationclj

(read-blob-with-generation client blob-id)

Read blob and return {:data :generation}, ::not-found if the blob is genuinely absent (.get returns nil), or nil if it was deleted DURING the read (404 — stale generation, i.e. a concurrent-modification conflict). The two absent cases are distinguished so PReadMissSafe can turn a genuine miss into store-key-not-found while optimistic locking still sees the conflict.

Read blob and return {:data :generation}, ::not-found if the blob is genuinely
absent (`.get` returns nil), or nil if it was deleted DURING the read (404 —
stale generation, i.e. a concurrent-modification conflict). The two absent
cases are distinguished so PReadMissSafe can turn a genuine miss into
store-key-not-found while optimistic locking still sees the conflict.
sourceraw docstring

releaseclj

(release _store env)

Used to close the store's Storage client. Clients are now shared across stores (see cloud-storage-client), and a client passed in by the caller was never this store's to close, so releasing a store is a no-op. Call shutdown-clients! on process exit to close the shared clients.

Used to close the store's Storage client. Clients are now shared across
stores (see `cloud-storage-client`), and a client passed in by the caller
was never this store's to close, so releasing a store is a no-op. Call
`shutdown-clients!` on process exit to close the shared clients.
sourceraw docstring

shutdown-clients!clj

(shutdown-clients!)

Close every shared Storage client and clear the cache. Call once on process shutdown. Stores connected before this call must not be used after it; cloud-storage-client builds fresh clients afterwards.

Close every shared Storage client and clear the cache. Call once on process
shutdown. Stores connected before this call must not be used after it;
`cloud-storage-client` builds fresh clients afterwards.
sourceraw docstring

spec->store-pathclj

(spec->store-path {:keys [store-path store-id]})
source

store-exists?clj

(store-exists? spec & {:keys [opts]})

Check if a konserve store exists at the given spec.

Check if a konserve store exists at the given spec.
sourceraw docstring

submit-delete-batchclj

(submit-delete-batch client bucket store-path store-keys)

Delete store-keys (at most batch-delete-max-calls) in ONE GCS batch request. Returns {store-key outcome}: true when the object was deleted, false when it did not exist, or an exception: the StorageException of a per-object failure, or an unanswered marker when the reply cannot be attributed.

A failure of the batch request itself throws; its outcome is unknown.

Delete `store-keys` (at most `batch-delete-max-calls`) in ONE GCS batch
request. Returns {store-key outcome}: true when the object was deleted, false
when it did not exist, or an exception: the StorageException of a per-object
failure, or an unanswered marker when the reply cannot be attributed.

A failure of the batch request itself throws; its outcome is unknown.
sourceraw docstring

write-blobclj

(write-blob client blob-id bytes)
source

write-blob-conditionalclj

(write-blob-conditional client blob-id bytes expected-generation)

Write bytes only if the object's generation is still expected-generation, or — when that is :absent — only if there is no object. True on success, false when GCS refuses.

GCS evaluates the precondition itself, which is what makes this backing's guarantee :global: the comparison and the write are one step against every writer anywhere, not merely those sharing a filesystem or a heap.

Create-if-absent is ifGenerationMatch(0). Zero is GCS's way of saying THE OBJECT MUST NOT EXIST, and using it keeps both halves of the contract on one mechanism rather than adding a separate existence probe that another writer could slip past.

412 is the refusal in both cases.

Write `bytes` only if the object's generation is still `expected-generation`, or
— when that is `:absent` — only if there is no object. True on success, false
when GCS refuses.

GCS evaluates the precondition itself, which is what makes this backing's
guarantee `:global`: the comparison and the write are one step against every
writer anywhere, not merely those sharing a filesystem or a heap.

Create-if-absent is `ifGenerationMatch(0)`. Zero is GCS's way of saying THE
OBJECT MUST NOT EXIST, and using it keeps both halves of the contract on one
mechanism rather than adding a separate existence probe that another writer
could slip past.

412 is the refusal in both cases.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close