Blobs and Blobentries
Types
DistributedFactorGraphs.Blobentry — Type
struct BlobentryA Blobentry is a small about of structured data that holds reference information to find an actual blob. Many Blobentrys can exist on different graph nodes spanning Agents and Factor Graphs which can all reference the same Blob.
DistributedFactorGraphs.addBlobentry! — Method
addBlobentry!(node, entry)
DistributedFactorGraphs.deleteBlobentry! — Method
deleteBlobentry!(node, label)
DistributedFactorGraphs.getBlobentry — Method
getBlobentry(node, label)
DistributedFactorGraphs.hasBlobentry — Method
hasBlobentry(node, label)
Does a blob entry exist with label.
DistributedFactorGraphs.listBlobentries — Method
listBlobentries(node)
List all Blobentry keys for a variable label in dfg
DistributedFactorGraphs.mergeBlobentry! — Method
mergeBlobentry!(node, entry)
DistributedFactorGraphs.verifyBlob — Method
verifyBlob(entry::Blobentry, blob) -> Union{Bool,Nothing}Checks the integrity of a blob against the hashes stored in the given Blobentry.
- Verifies the
multihashby decoding its algorithm code, recomputing the digest fromblob, and comparing it to the stored digest. - Additionally verifies the
crc32csumchecksum. - Returns
trueif all present hashes match. - Returns
falseif any hash does not match. - Returns
nothingif the multihash algorithm is unregistered.
DistributedFactorGraphs.AbstractBlobprovider — Type
AbstractBlobproviderAbstract supertype for all blob storage implementations in the Virtual Blob System (VBS).
Every concrete subtype represents a physical storage backend and must carry a label::Symbol field (defaulting to :default) that the VBS uses as its routing key. The label also doubles as the provider hint stored in every Blobentry created through this provider.
Required Interface (Layer 1 — Storage Physics)
Subtypes must implement the following Content-Addressable Storage (CAS) primitives, which operate exclusively on raw bytes and Multihashes — no graph logic:
putBlob!(provider, m::Multihash, blob::Vector{UInt8}) -> Multihash— Idempotently store blob at keym. (A convenienceputBlob!(provider, blob; hash_func)that hashes and delegates is provided.)fetchBlob(provider, multihash) -> Union{Vector{UInt8}, Nothing}— Fetch raw bytes by Multihash, ornothingif absent.hasBlob(provider, multihash) -> Bool— Fast existence / deduplication check.purgeBlob!(provider, multihash)— Physical removal.
Routing & Labelling
Every concrete implementation should accept an optional label keyword in its constructor:
FolderBlobprovider(path::String; label::Symbol = :default)
NavAbilityBlobprovider(; label::Symbol = :default)
CachedBlobprovider(local, remote; label::Symbol = :default)Mount providers onto a graph with:
addBlobprovider!(dfg, provider) # mounts under provider.label
getBlobprovider(dfg, label::Symbol) # retrieves by label
listBlobproviders(dfg) # lists all mounted labelsCAS Design Principles
- Blobs are immutable and identified by the cryptographic Multihash of their content, not by random UUIDs. This guarantees global deduplication across all providers.
putBlob!is idempotent: uploading the same bytes twice is a no-op.- Physical blobs are never deleted through the graph metadata API. Only the
Blobentrypointer is removed (deleteVariableBlobentry!etc.); garbage collection handles physical cleanup asynchronously. - All providers sharing the same content hash hold identical, interchangeable bytes.
Core Implementations
FolderBlobprovider— Local disk I/O; acts as a fast ephemeral LRU cache.MemoryBlobprovider— In-memory storage for testing and transient data.CachedBlobprovider— Write-through wrapper composing a local and a remote provider.
Functions
DistributedFactorGraphs.getfirstBlobentry — Method
getfirstBlobentry(
node;
whereLabel,
whereMultihash,
sortby,
sortlt
)
Finds and returns the first blob entry that matches the filter. The result is sorted by sortby[=getLabel] and sortlt[=natural_lt] before returning the first entry. Also see: getBlobentry
DistributedFactorGraphs.incrDataLabelSuffix — Method
incrDataLabelSuffix(dfg, vla, bllb; datalabel)
If the blob label datalabel already exists, then this function will return the name datalabel_1. If the blob label datalabel_1 already exists, then this function will return the name datalabel_2.
DistributedFactorGraphs.listBlobentrySequence — Function
listBlobentrySequence(dfg, lb, pattern)
listBlobentrySequence(dfg, lb, pattern, _sort)
List a collection of blob entries per variable that match a particular pattern::Regex.
Notes
- Optional sort function argument, default is unsorted.
- Likely use of
sortDFGfor basic Symbol sorting.
- Likely use of
Example
listBlobentrySequence(fg, :x0, r"IMG_CENTER", sortDFG)
15-element Vector{Symbol}:
:IMG_CENTER_21676
:IMG_CENTER_21677
:IMG_CENTER_21678
:IMG_CENTER_21679
...DistributedFactorGraphs.addBlobprovider! — Function
Add a blobprovider to the DFG.
DistributedFactorGraphs.applyBlobproviders! — Method
applyBlobproviders!(dfg::AbstractDFG)Read the __blobproviders__ graph bloblet, deserialize the provider configs, and merge! them into dfg.blobproviders. Returns the number of providers applied. Returns 0 if no stashed config exists.
See also: stashBlobproviders!
DistributedFactorGraphs.deleteBlobprovider! — Function
Delete the link to a blobprovider by label. Returns 0 if not found.
DistributedFactorGraphs.fetchBlob — Function
Fetch a blob from a Blobprovider. Returns nothing when the multihash is not present (never throws for a missing key).
Related getBlobentry Implement fetchBlob(provider::AbstractBlobprovider, m::Multihash) -> Union{Vector{UInt8}, Nothing}
fetchBlob(provider, m)fetchBlob(store, m)fetchBlob(store, m)fetchBlob(provider, m)fetchBlob(provider, entry)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blobprovider_ops.jl:154.
DistributedFactorGraphs.getBlobprovider — Function
Get a blobprovider by label.
DistributedFactorGraphs.getBlobproviders — Function
Get all blobproviders in the DFG.
DistributedFactorGraphs.hasBlob — Function
Check if the blob provider has a blob with the given multihash.
DistributedFactorGraphs.hasBlobprovider — Function
Check whether a blobprovider with the given label exists.
DistributedFactorGraphs.listBlobproviders — Function
List all blobprovider labels in the DFG.
DistributedFactorGraphs.listBlobs — Function
List all multihashes in the blob provider. Implement listBlobs(provider::AbstractBlobprovider)
DistributedFactorGraphs.mergeBlobprovider! — Function
Merge a single blobprovider link into the DFG (idempotent if identical).
DistributedFactorGraphs.mergeBlobproviders! — Function
Merge a vector of blobprovider links into the DFG.
DistributedFactorGraphs.purgeBlob! — Function
Purge (physically remove) a blob from the provider.
Related deleteBlobentry! Implement purgeBlob!(provider::AbstractBlobprovider, m::Multihash)
purgeBlob!(provider, m)purgeBlob!(store, m)purgeBlob!(store, m)purgeBlob!(provider, m)DistributedFactorGraphs.putBlob! — Function
Put a blob into the Blobprovider (idempotent CAS write).
The convenience method hashes once and delegates to the core storage method:
putBlob!(provider, blob::Vector{UInt8}; hash_func) -> Multihash # hashes, delegates
putBlob!(provider, m::Multihash, blob) -> Multihash # core — implement thisRelated addBlobentry!
putBlob!(provider, m, blob)putBlob!(store, m, blob)putBlob!(store, m, blob)putBlob!(provider, filepath; hash_func)putBlob!(provider, m, filepath)putBlob!(provider, blob; hash_func)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blobprovider_ops.jl:159.
DistributedFactorGraphs.refBlobproviders — Function
Return the internal blobprovider dictionary reference for dfg.
DistributedFactorGraphs.stashBlobproviders! — Method
stashBlobproviders!(dfg::AbstractDFG)Serialize the current blobprovider dict and store it as a graph bloblet under the reserved key __blobproviders__. Existing bloblet is overwritten.
See also: applyBlobproviders!
DistributedFactorGraphs.getDataFormat — Method
getDataFormat(::MIME) -> Union{Type{DataFormat{S}}, Nothing}Get the FileIO DataFormat for a MIME type. Uses MIMEs.jl and FileIO's extension registry, falls back to _MIMEOverrides.
Returns nothing if no matching format is found.
Examples
getDataFormat(MIME("image/png")) # format"PNG"
getDataFormat(MIME("application/json")) # format"JSON"DistributedFactorGraphs.getMimetype — Method
getMimetype(io::IO) -> MIMEDetect the MIME type of data in an IO stream using FileIO's format detection.
DistributedFactorGraphs.getMimetype — Method
getMimetype(::Type{DataFormat{S}}) -> MIMEGet the MIME type for a FileIO DataFormat. Uses FileIO's extension registry and MIMEs.jl for standard types, falls back to _MIMEOverrides for domain-specific formats.
Examples
getMimetype(format"PNG") # MIME("image/png")
getMimetype(format"JSON") # MIME("application/json")DistributedFactorGraphs.packBlob — Function
packBlobConvert data to Vector{UInt8} for use as a Blob. Returns (blob, mimetype). The MIME type is automatically determined from the DataFormat.
DistributedFactorGraphs.unpackBlob — Function
unpackBlobConvert a Blob back to the original type using the MIME type or DataFormat type.
DistributedFactorGraphs.loadAgentBlob — Function
Load a Blob for a given agent and Blobentry label.
loadAgentBlob(dfg, agentlabel, entry_label)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:142.
DistributedFactorGraphs.loadFactorBlob — Function
Load a Blob for a given factor and Blobentry label.
loadFactorBlob(dfg, factor_label, entry_label)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:182.
DistributedFactorGraphs.loadGraphBlob — Function
Load a Blob for a given graph and Blobentry label.
loadGraphBlob(dfg, entry_label)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:108.
DistributedFactorGraphs.loadVariableBlob — Function
Load a Blob for a given variable and Blobentry label.
loadVariableBlob(dfg, variable_label, entry_label)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:68.
DistributedFactorGraphs.saveAgentBlob! — Function
Save a Blob to a Blobprovider and attach a Blobentry to an agent.
saveAgentBlob!(dfg, agentlabel, blob, entry)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:151.
saveAgentBlob!(dfg, agentlabel, blob, entry_label; ...)
saveAgentBlob!(
dfg,
agentlabel,
blob,
entry_label,
provider;
blobentry_kwargs...
)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:164.
DistributedFactorGraphs.saveFactorBlob! — Function
Save a Blob to a Blobprovider and attach a Blobentry to a factor.
saveFactorBlob!(dfg, factor_label, blob, entry)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:191.
saveFactorBlob!(dfg, factor_label, blob, entry_label; ...)
saveFactorBlob!(
dfg,
factor_label,
blob,
entry_label,
provider;
blobentry_kwargs...
)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:204.
DistributedFactorGraphs.saveGraphBlob! — Function
Save a Blob to a Blobprovider and attach a Blobentry to a graph.
saveGraphBlob!(dfg, blob, entry)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:117.
saveGraphBlob!(dfg, blob, entry_label; ...)
saveGraphBlob!(
dfg,
blob,
entry_label,
provider;
blobentry_kwargs...
)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:125.
DistributedFactorGraphs.saveVariableBlob! — Function
Save a Blob to a Blobprovider and attach a Blobentry to a variable.
saveVariableBlob!(dfg, variable_label, blob, entry)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:77.
saveVariableBlob!(
dfg,
variable_label,
blob,
entry_label;
...
)
saveVariableBlob!(
dfg,
variable_label,
blob,
entry_label,
provider;
blobentry_kwargs...
)defined at /home/runner/work/DistributedFactorGraphs.jl/DistributedFactorGraphs.jl/src/services/blob_save_load.jl:90.
DistributedFactorGraphs.CachedBlobprovider — Type
CachedBlobprovider(local, remote; label = :default)A write-through CAS cache that composes two AbstractBlobproviders.
putBlob!: Writes to bothremoteandlocal(remote first).fetchBlob: Reads fromlocalfirst; on miss, fetches fromremoteand caches locally.purgeBlob!: Purges from both stores.hasBlob: Checks local, falls back to remote.listBlobs: Delegates to remote (the authoritative provider).
DistributedFactorGraphs.LinkBlobprovider — Type
LinkBlobprovider(folder; label = :default)A CAS provider that hardlinks existing files into the standard sharded folder layout (same as FolderBlobprovider). This avoids copying large files while still making them addressable by Multihash.
The specialised putBlob!(provider, filepath::String) streams the file to compute its hash (no full load into RAM), then creates a hardlink at the CAS path. All other Layer 1 verbs (fetchBlob, hasBlob, purgeBlob!, listBlobs) behave identically to FolderBlobprovider.
DistributedFactorGraphs.blobfilename — Method
blobfilename(folder, m::Multihash) -> StringGenerates the physical file path for a blob using a Git/IPFS style sharding strategy to prevent OS directory-size limits.