(*decrypt-byte-string* v)
Inputs: [v :- ByteString] Returns: ByteString
Dynamic function used to decrypt the individual block vals. Default implementation is a no-op; rebind this function to provide actual decryption logic.
Inputs: [v :- ByteString] Returns: ByteString Dynamic function used to decrypt the individual block vals. Default implementation is a no-op; rebind this function to provide actual decryption logic.
(*encrypt-byte-string* v)
Inputs: [v :- ByteString] Returns: ByteString
Dynamic function used to encrypt the individual block vals. Default implementation is a no-op; rebind this function to provide actual encryption logic.
Inputs: [v :- ByteString] Returns: ByteString Dynamic function used to encrypt the individual block vals. Default implementation is a no-op; rebind this function to provide actual encryption logic.
By default Blocks have a maximum size of 64 KB
By default Blocks have a maximum size of 64 KB
Storage is block-addressable: i.e., a block is the smallest unit that Storage is aware of. This methods are for Storage implementors and should NEVER be called directly!
Storage is block-addressable: i.e., a block is the smallest unit that Storage is aware of. This methods are for Storage implementors and should NEVER be called directly!
(storage-compare-and-set-block s expected-block replacement-block)
compare-and-set expected-block for replacement block. Returns true/false to indicate success.
compare-and-set expected-block for replacement block. Returns true/false to indicate success.
(storage-create-block s block)
create-block writes block IFF NO OTHER BLOCK HAS BEEN WRITTEN WITH THAT ID. Returns true/false.
create-block writes block IFF NO OTHER BLOCK HAS BEEN WRITTEN WITH THAT ID. Returns true/false.
(storage-delete-blocks s namespace ids)
deletes blocks from BlockStore, returns a sequence of ids of deleted blocks
deletes blocks from BlockStore, returns a sequence of ids of deleted blocks
(storage-read-blocks s read-mode namespace ids)
reads blocks from BlockStore, returns a sequence of blocks.
reads blocks from BlockStore, returns a sequence of blocks.
(storage-write-blocks s write-mode blocks)
writes blocks to BlockStore, returns a sequence of maps {:keys [namespace id]} of written blocks
writes blocks to BlockStore, returns a sequence of maps {:keys [namespace id]} of written blocks
(compare-and-set-block storage expected-block replacement-block)
Replaces a block in storage. Operation is atomic. Returns true if swap is successful.
Compares expected-block to current block in storage. If equal, replacement-block overwrites the current block. If not equal, no change occurrs.
Replaces a block in storage. Operation is atomic. Returns true if swap is successful. Compares expected-block to current block in storage. If equal, replacement-block overwrites the current block. If not equal, no change occurrs.
(create-block storage block)
Atomically writes a block to storage IF IT DOES NOT EXIST ALREADY. Returns true if the write is successful. If the block already exists, it is NOT overwritten, and create-block will return false.
Atomically writes a block to storage IF IT DOES NOT EXIST ALREADY. Returns true if the write is successful. If the block already exists, it is NOT overwritten, and create-block will return false.
(decrypt-block decrypt b)
Inputs: [decrypt :- IFn b :- Block] Returns: Block
Inputs: [decrypt :- IFn b :- Block] Returns: Block
(delete-block storage namespace id)
Inputs: [storage :- (s/protocol BlockStorage) namespace :- ID id :- ID] Returns: (s/maybe {:namespace ID, :id ID})
Inputs: [storage :- (s/protocol BlockStorage) namespace :- ID id :- ID] Returns: (s/maybe {:namespace ID, :id ID})
(delete-blocks storage namespace ids)
Deletes the specified blocks from storage. Returns the ids of successfully deleted blocks.
Delete is idempotent; deleting and ID that does not exist will return success.
Deletes the specified blocks from storage. Returns the ids of successfully deleted blocks. Delete is idempotent; deleting and ID that does not exist will return success.
(encrypt-block encrypt b)
Inputs: [encrypt :- IFn b :- Block] Returns: Block
Inputs: [encrypt :- IFn b :- Block] Returns: Block
Blocks can be partially loaded from storage. This protocol allows testing and loading of partially loaded Blocks.
Blocks can be partially loaded from storage. This protocol allows testing and loading of partially loaded Blocks.
(load-from x block-store)
return copy of item that has been loaded from the block-store
return copy of item that has been loaded from the block-store
(loaded? x)
returns true if item has been loaded
returns true if item has been loaded
(ptr block)
(ptr namespace id)
Inputs: ([block :- (s/protocol StorageBlock)] [namespace :- ID id :- ID]) Returns: Ptr
Inputs: ([block :- (s/protocol StorageBlock)] [namespace :- ID id :- ID]) Returns: Ptr
(read-block storage read-mode namespace id)
Inputs: [storage :- (s/protocol BlockStorage) read-mode :- ReadMode namespace :- ID id :- ID] Returns: (s/maybe Block)
Inputs: [storage :- (s/protocol BlockStorage) read-mode :- ReadMode namespace :- ID id :- ID] Returns: (s/maybe Block)
(read-blocks storage read-mode namespace ids)
(read-blocks storage
read-mode
namespace
ids
{:as opts :keys [decrypt] :or {decrypt *decrypt-byte-string*}})
Reads blocks in the given namespace from storage.
read-mode: specify ':read-full' to read the entire block (attrs + val); specify ':read-attrs' to only load the block attrs
opts keys: specify :decrypt with a function that will be applied to each read block. Function will be passed a block and is expected to decrypt the block's :val and return the decrypted block. If ommited, will default to the dynamic function 'decrypt-block-val'
Reads blocks in the given namespace from storage. read-mode: specify ':read-full' to read the entire block (attrs + val); specify ':read-attrs' to only load the block attrs opts keys: specify :decrypt with a function that will be applied to each read block. Function will be passed a block and is expected to decrypt the block's :val and return the decrypted block. If ommited, will default to the dynamic function '*decrypt-block-val*'
(read-blocks-only storage read-mode namespace ids)
Inputs: [storage :- (s/protocol BlockStorage) read-mode :- ReadMode namespace :- ID ids :- [ID]] Returns: [Block]
See read-blocks. This works the same but does NOT decrypt.
Inputs: [storage :- (s/protocol BlockStorage) read-mode :- ReadMode namespace :- ID ids :- [ID]] Returns: [Block] See read-blocks. This works the same but does NOT decrypt.
Read Modes control whether the entire Block is loaded from storage, or only the Block's attributes.
Read Modes control whether the entire Block is loaded from storage, or only the Block's attributes.
Getters/setters for a Block. Because it has more type restrictions than a normal record, this provides a convenient way to document/enforce these.
Getters/setters for a Block. Because it has more type restrictions than a normal record, this provides a convenient way to document/enforce these.
(attributes _)
(attributes _ attribute)
(attributes _ attribute val)
Get all attributes, a single attribute, or set a single attribute in this Block's attribute map.
Get all attributes, a single attribute, or set a single attribute in this Block's attribute map.
(storage-id _)
(storage-id _ id)
Get or set the id (String) of this block.
Get or set the id (String) of this block.
(storage-namespace _)
(storage-namespace _ ns)
Get or set the namespace (String) of this block.
Get or set the namespace (String) of this block.
(value _)
(value _ v-or-f)
Get or set or update the value (ByteString) of this Block.
Get or set or update the value (ByteString) of this Block.
(strict-map->Block m28166 & [drop-extra-keys?__5380__auto__])
Factory function for class Block, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class Block, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(strict-map->Ptr m28070 & [drop-extra-keys?__5380__auto__])
Factory function for class Ptr, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
Factory function for class Ptr, taking a map of keywords to field values. All keys are required, and no extra keys are allowed. Even faster than map->
(write-block storage write-mode block)
Inputs: [storage :- (s/protocol BlockStorage) write-mode :- WriteMode block :- Block] Returns: (s/maybe {:namespace ID, :id ID})
Inputs: [storage :- (s/protocol BlockStorage) write-mode :- WriteMode block :- Block] Returns: (s/maybe {:namespace ID, :id ID})
(write-blocks storage write-mode blocks)
(write-blocks storage
write-mode
blocks
{:keys [encrypt] :or {encrypt *encrypt-byte-string*}})
Writes block into storage. Existing blocks will be overwritten in-place. Returns a sequence of the block-ids that were successfully written.
write-mode: specify ':write-full' to write the entire block (attrs + val) specify ':write-attrs to write only the block attrs, leaving the existing val unchanged
opts keys: specify :encrypt with a function that will be applied to each block before writing. Function will be passed a block and is expected to encrypt the blocks's :val and return the encrypted block. If ommitted will default to the dynamic function 'encrypt-block-val'.
Writes block into storage. Existing blocks will be overwritten in-place. Returns a sequence of the block-ids that were successfully written. write-mode: specify ':write-full' to write the entire block (attrs + val) specify ':write-attrs to write only the block attrs, leaving the existing val unchanged opts keys: specify :encrypt with a function that will be applied to each block before writing. Function will be passed a block and is expected to encrypt the blocks's :val and return the encrypted block. If ommitted will default to the dynamic function '*encrypt-block-val*'.
(write-blocks-only storage write-mode blocks)
Inputs: [storage :- (s/protocol BlockStorage) write-mode :- WriteMode blocks :- [Block]] Returns: [{:namespace ID, :id ID}]
See write-blocks. This works the same but does NOT encrypt.
Inputs: [storage :- (s/protocol BlockStorage) write-mode :- WriteMode blocks :- [Block]] Returns: [{:namespace ID, :id ID}] See write-blocks. This works the same but does NOT encrypt.
Write Modes control whether the entire Block is written to storage, or only the Block's attributes.
Write Modes control whether the entire Block is written to storage, or only the Block's attributes.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close