Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Commit 1dfbcc1

Browse files
committed
Initial Draft
1 parent fa7a20a commit 1dfbcc1

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

draft.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Draft Ipld Unixfs Spec
2+
3+
## Basic Structure
4+
5+
- Some sort of header that indicates that this a directory and included a version number. The header could also have fields to give additional information on the meaning of the extended attributes.
6+
7+
- CBOR Map
8+
- Key: CBOR Byte or Text String: File Name
9+
- Value: CBOR Array of:
10+
- Type: CBOR Unsigned Int
11+
- Link or Data: CBOR Type varies
12+
- Optional file size: CBOR Unsigned Int
13+
- Optional Standard Attributes: CBOR Map
14+
- Optional Extended Attributes: CBOR Map
15+
16+
The file size is only defined for regular files and is the size of the file contents.
17+
18+
All maps should be ordered based on the binary values of the key,
19+
duplicates are not allowed.
20+
21+
### Notes
22+
23+
* An array makes sense to be as this is more compact and the value of
24+
the fields are unambiguous, it also allows for a separation of
25+
standard and extended attributes
26+
27+
* The key type can either be a byte or text string as POSIX makes no
28+
requirements that file names be utf-8 and it is important that any
29+
file name can be faithfully represented, if the string is utf-8
30+
then the type will be Text.
31+
32+
## Types
33+
34+
The type field should be limited to a set of well defined values so it
35+
makes sense that this is an integer rather than a text string. The
36+
value is the ascii value of a letter. When converting to JSON the
37+
integer can be represented as a single character string.
38+
39+
Possible values are as follows:
40+
41+
* 0, '', `file`: regular file
42+
* `e`, `exe`: executable file
43+
* `d`, `dir`: directory entry
44+
* `s`, `special`: special file type (fifo, device, etc). The second field is a CBOR Map with at least one field to describe the type.
45+
* `l`, `symlink`: symbolic link. The second field is the contents of the link
46+
* `o`, `other`: link to other ipld object, links followed for GC and related operations
47+
* `u`, `unknown`: link to unknown objects, links not followed
48+
49+
### Notes
50+
51+
* Rather than have a special attribute for an executable bit it is more compact if we just make this a different type
52+
* It is very useful to be able to determine if a link is a directory or an ordinary file so I made it as separate type, also there can be multiple ways to define a file size for a directory so it is best to just leave it out as it is of limited usefulness
53+
54+
## Standard Attributes:
55+
56+
The standard set of attributes should be limited to a small set of meaningful values.
57+
Stripping this filed SHOULD not change the meaning of the directory entry.
58+
Clients SHOULD be able to understand these attributes when reading a directory entry.
59+
60+
Possible entries:
61+
62+
* `mtime`
63+
* `ro`: Boolean, set if the file or directory should be readonly when copied to the filesystem
64+
65+
## Extended Attributes
66+
67+
The extended attributes set is not well defined and can be used for vendor extensions and posix attributes that don't make sense on non-unix systems.
68+
Stripping this field MUST not change the meaning of the directory entry.
69+
These attributes SHOULD be passed along but do not have to be understood.
70+
The directory header MAY include information on the meaning of the attributes;
71+
for example it could indicate that this is a copy of a unix filesystem and to expect a standard set of corresponding attributes.
72+
73+
Possible entries:
74+
75+
* `user`: unix user name
76+
* `uid`: unix numeric uid
77+
* `group`: unix group name
78+
* `gid`: unix numeric gid
79+
* `perm`: full unix permissions
80+
* extended posix attributes
81+
* windows specific attributes

0 commit comments

Comments
 (0)