Module hdk::hash_path::shard [−][src]
Expand description
A String
based DSL for path::Path
that builds trees based on lexical granularity.
The basic form is width:depth#
in the string with .
separators for each component.
For example foo.2:3#holochain
would expand to a path with string components:
[ "foo" ho lo ch holochain]
The widths of strings are normalised as UTF32 as path components so multibyte characters count as 1.
The tests in the shard module include several examples of the DSL including multibyte characters.
Structs
A valid strategy for sharding requires both a width and a depth. At the moment sharding only works well for data that is reliably longer than width/depth. For example, sharding the username foo with width 4 doesn’t make sense. There is no magic padding or extending of the provided data to make up undersized shards. @todo stretch short shards out in a nice balanced way (append some bytes from the hash?)
Enums
Constants
Type Definitions
The depth of a shard is the number of path components to stretch out for shards. e.g. abcdef with a depth of 1 and width 1 shards to a.abcdef and depth 2 shards to a.b.abcdef.
The width of a shard is how many bytes/characters to use for each path component in sharding. e.g. abcdef with width 1 shards to a.b.c.d.e.f.abcdef and 2 shards to ab.cd.ef.abcdef.