fluree.db.json-ld.api

address?

(address? ledger-alias-or-address)
Returns true if the argument is a full ledger address, false if it is just an
alias.

alias->address

(alias->address conn ledger-alias)
Returns a core.async channel with the connection-specific address of the
given ledger-alias.

branch

(branch)
Creates a new branch of a given ledger

combine

(combine)
Combines multiple ledgers into a new, read-only ledger.

commit!

(commit! ledger db)(commit! ledger db opts)
Commits a staged database to the ledger with all changes since the last commit
aggregated together.

Commits are tracked in the local environment, but if the ledger is distributed
it will still need a 'push' to ensure it is published and verified as per the
distributed rules.

connect

(connect {:keys [method parallelism remote-servers], :as opts})
Forms connection to ledger, enabling automatic pulls of new updates, event
services, index service.

Multiple connections to same endpoint will share underlying network connection.

Options include:
  - did - (optional) DId information to use, if storing blocks as verifiable credentials,
          or issuing queries against a permissioned database.
  - write - (optional) Function to use for all writes, if empty will store in memory until a commit is performed
  - read - (optional) Function to use for reads of persisted blocks/data
  - commit - (optional) Function to use to write commits. If persistence desired, this must be defined
  - push - (optional) Function(s) in a vector that will attempt to push the commit to naming service(s)
  

connect-file

(connect-file opts)

connect-ipfs

(connect-ipfs opts)
Forms an ipfs connection using default settings.
- server - (optional) IPFS http api server endpoint, defaults to http://127.0.0.1:5001/
- profile - (optional) IPFS stored profile to use.
- did - (optional) DId information to use, if storing blocks as verifiable credentials

connect-memory

(connect-memory opts)
Forms an in-memory connection using default settings.
- did - (optional) DId information to use, if storing blocks as verifiable credentials

create

(create conn)(create conn ledger-alias)(create conn ledger-alias opts)
Creates a new json-ld ledger. A connection (conn)
must always be supplied.

Ledger-name (optional) is a friendly name that is used for:
- When publishing to a naming service that allows multiple pointers for the
  same namespace (e.g. IPNS), this becomes a sub-directory off the namespace.
  For multple directories deep, use '/' for a
  e.g. the ledgers movies/popular, books/authors, books/best-sellers could
  use the same IPNS id (in this example using IPNS DNSLink):
  fluree:ipns://my.dns.com/books/authors
  fluree:ipns://my.dns.com/books/best-sellers
  fluree:ipns://my.dns.com/movies/top-rated
- When combining multiple ledgers, each ledger becomes an individual named
  graph which can be referenced by name.

Options map (opts) can include:
- did - DId information to use, if storing blocks as verifiable credentials

create-with-txn

(create-with-txn conn txn)

db

(db ledger)(db ledger opts)
Retrieves latest db, or optionally a db at a moment in time
and/or permissioned to a specific identity.

exists?

(exists? conn ledger-alias-or-address)
Returns a promise with true if the ledger alias or address exists, false
otherwise.

expand-iri

(expand-iri context compact-iri)
Expands given IRI with the default database context, or provided context.

history

(history ledger query)
Return the change history over a specified time range. Optionally include the commit
that produced the changes.

index

(index ledger)
Performs indexing operation on the specified ledger

internal-id

(internal-id db iri)
Returns the internal Fluree integer id for a given IRI.
This can be used for doing range scans, slices and for other
more advanced needs.

Returns promise

load

(load conn alias-or-address)
Loads an existing ledger by its alias (which will be converted to a
connection-specific address first).

merge

(merge)
Merges changes from one branch into another branch.

notify

(notify conn commit-map)
Notifies the connection with a new commit map (parsed JSON commit with string keys).

If the connection knows of the ledger, and is currently maintaining
an in-memory version of the ledger, will attempt to update the db if the commit
is for the next 't' value. If a commit is for a past 't' value, noop.
If commit is for a future 't' value, will drop in-memory ledger for reload upon next request.

promise-wrap

(promise-wrap port)
Wraps an async channel that will contain a response in a promise.

pull

(pull)
Checks name service for ledger and pulls latest version locally.

push

(push)
Pushes all commits since last push to a name service, e.g. a Fluree Network, IPNS, DNS, Fluree Nexus.
Depending on consensus requirements for a Fluree Network, will accept or reject push as newest update.

query

(query db q)(query db q opts)
Queries a db value and returns a promise with the results.

query-connection

(query-connection conn q)(query-connection conn q opts)
Queries the latest db in the ledger specified by the 'from' parameter in the
query (what that actually looks like is format-specific). Returns a promise
with the results.

range

(range db index test match)(range db index start-test start-match end-test end-match)
Performs a range scan against the specified index using test functions
of >=, <=, >, <

slice

(slice db index match)
Like range, but returns all flakes that match the supplied flake parts.

squash

(squash)
Squashes multiple unpublished commits into a single unpublished commit

stage

(stage db json-ld)(stage db json-ld opts)
Performs a transaction and queues change if valid (does not commit)

status

(status ledger)(status ledger branch)
Returns current status of ledger branch.

transact!

(transact! conn txn)

validate

(validate)
Validates a ledger, checks block integrity along with signatures.

wrap-policy

(wrap-policy db identity-map)(wrap-policy db identity-map context)
Wraps a db object with specified permission attributes.
When requesting a db from a ledger, permission attributes can
be requested at that point, however if one has a db already, this
allows the permission attributes to be modified.

Returns promise