(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.
(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.
(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.
(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.(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.
(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.
(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.
(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.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |