(acquire-indexing-lock! session block)
Attempts to acquire indexing lock, and if successful returns true, else false.
Attempts to acquire indexing lock, and if successful returns true, else false.
(blank-db conn ledger)
Creates a session and returns a blank db.
Creates a session and returns a blank db.
(block-response->tx-response block-result txid)
Blocks can have multiple transactions. If we are monitoring a single transaction we take a full block response and return a map with just that transaction's details. If the entire block details are desired, the block can be used to retrieve them.
If throw? is true, throws an exception if non-2xx response.
Blocks can have multiple transactions. If we are monitoring a single transaction we take a full block response and return a map with just that transaction's details. If the entire block details are desired, the block can be used to retrieve them. If throw? is true, throws an exception if non-2xx response.
(cas-db! session old-db-ch new-db-ch)
Performs a compare and set! to update db, but only does so if existing db promise-chan is the same as old-db-ch.
Returns true if successful, false if it did not replace.
Performs a compare and set! to update db, but only does so if existing db promise-chan is the same as old-db-ch. Returns true if successful, false if it did not replace.
(clear-db! session)
Clears db from cache, forcing a new full load next time db is requested.
Clears db from cache, forcing a new full load next time db is requested.
(close session)
(close network dbid)
Properly shuts down a session. Returns true if shut down, false if it was already shut down.
Calling with a session will shut down session, calling with two arity network + dbid will see if a session is in cache and then perform the shutdown on the cached session, else will return false.
Properly shuts down a session. Returns true if shut down, false if it was already shut down. Calling with a session will shut down session, calling with two arity network + dbid will see if a session is in cache and then perform the shutdown on the cached session, else will return false.
(close-all-sessions)
(close-all-sessions conn-id)
Useful for a shutdown process. Closes all sessions for a given connection-id. If no connection given, closes all sessions.
Useful for a shutdown process. Closes all sessions for a given connection-id. If no connection given, closes all sessions.
(closed? session)
(current-db session)
Gets the latest db from the central DB atom if available, or loads it from scratch. DB is returned as a core async promise channel.
Gets the latest db from the central DB atom if available, or loads it from scratch. DB is returned as a core async promise channel.
(db conn ledger opts)
Returns core async channel containing current db
Returns core async channel containing current db
(indexed session)
Returns block of last indexed block, but only for indexing done by this server.
Returns block of last indexed block, but only for indexing done by this server.
(indexing? session)
Returns block currently being indexed (truthy), or nil (falsey) if not currently indexing.
Returns block currently being indexed (truthy), or nil (falsey) if not currently indexing.
(ledger-alias->id conn network alias)
Returns ledger id from alias.
Returns ledger id from alias.
(monitor-tx session tid key f)
Adds a callback function to call when we see a completed transaction in a block for the given tid.
Key is any arbitrary key provided that allows the callback to be unregistered later with monitor-tx-remove. It must be unique.
Adds a callback function to call when we see a completed transaction in a block for the given tid. Key is any arbitrary key provided that allows the callback to be unregistered later with monitor-tx-remove. It must be unique.
(monitor-tx-remove session tid key)
Removes callback from supplied transaction id and key.
Will return true if callback successfully removed, else false if callback didn't exist.
Removes callback from supplied transaction id and key. Will return true if callback successfully removed, else false if callback didn't exist.
(release-indexing-lock! session block)
Releases indexing lock, and updates the last indexed value on the connection with provided block number.
Releases indexing lock, and updates the last indexed value on the connection with provided block number.
(reload-db! session)
Clears any current db that is cached and forces a db reload.
Clears any current db that is cached and forces a db reload.
(remove-cache! network dbid)
Removes a specific session from cache.
Removes a specific session from cache.
(reset-cache!)
Clears entire session cache. Should not be used under normal circumstances as sessions will not be properly closed.
Clears entire session cache. Should not be used under normal circumstances as sessions will not be properly closed.
(resolve-ledger conn ledger)
Resolves a ledger identity in the form of 'network/alias' and returns a two-tuple of [network ledger-id].
An alias lookup is always performed first, and if an alias doesn't exist it is assumed the provided name is a ledger-id.
If you are providing a ledger-id, and wish to skip an alias lookup, a prefix of '$' can be used for the name portion of the ledger.
i.e.
Resolves a ledger identity in the form of 'network/alias' and returns a two-tuple of [network ledger-id]. An alias lookup is always performed first, and if an alias doesn't exist it is assumed the provided name is a ledger-id. If you are providing a ledger-id, and wish to skip an alias lookup, a prefix of '$' can be used for the name portion of the ledger. i.e. - testnet/testledger - Look for ledger with an alias testledger on network testnet. - testnet/$testledger - look for a ledger with id testledger on network testnet (skip alias lookup). - [testnet testledger] - already in form of [network ledger-id]
(session conn ledger)
(session conn ledger {:keys [state connect? auth jwt]})
Returns connection to the given ledger, and ensures it is cached.
If 'state' is provided, it will get merged into the connection's state. Use namespaced keys, so as to not to create a conflict with system state keys.
Options supported:
Returns connection to the given ledger, and ensures it is cached. If 'state' is provided, it will get merged into the connection's state. Use namespaced keys, so as to not to create a conflict with system state keys. Options supported: - connect? - attempts to create a streaming connection to db - will fail if db does not exist - ensure is 'false' if trying to create a new db that does not yet exist. - state - initial state map to use - auth - the auth - jwt - jwt from password login
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close