Documentation ¶
Overview ¶
Package path contains utilities to work with dms3 paths.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SplitAbsPath ¶
SplitAbsPath clean up and split fpath. It extracts the first component (which must be a Multihash) and return it separately.
Types ¶
type Path ¶
type Path string
A Path represents an dms3 content path:
- /<cid>/path/to/file
- /dms3/<cid>
- /dms3ns/<cid>/path/to/folder
- etc
func FromSegments ¶
FromSegments returns a path given its different segments.
func FromString ¶
FromString safely converts a string type to a Path type.
func ParseCidToPath ¶
ParseCidToPath takes a CID in string form and returns a valid dms3 Path.
func ParsePath ¶
ParsePath returns a well-formed dms3 Path. The returned path will always be prefixed with /dms3/ or /dms3ns/. The prefix will be added if not present in the given string. This function will return an error when the given string is not a valid dms3 path.
func (Path) IsJustAKey ¶
IsJustAKey returns true if the path is of the form <key> or /dms3/<key>, or /ld/<key>
func (Path) PopLastSegment ¶
PopLastSegment returns a new Path without its final segment, and the final segment, separately. If there is no more to pop (the path is just a key), the original path is returned.