ArkThis / AHAlodeck

The place to be for discussing future any-data layouts.
GNU General Public License v3.0
3 stars 0 forks source link

Question about user namespace #3

Open ross-spencer opened 1 month ago

ross-spencer commented 1 month ago

Are all xattrs usually prefixed with user e.g. user.checksum? ref: https://wiki.archlinux.org/title/Extended_attributes

And should there be a further prefix for this app when they're set by it, e.g. user.mercs.YYYY?

pjotrek-b commented 1 month ago

For Linux, 4 namespaces exist:

  1. user
  2. trusted
  3. security
  4. system.

Where "user" is the (only) one currently assigned for arbitrary use (eg for annotation).

Quote: https://en.wikipedia.org/wiki/Extended_file_attributes#Linux

The name must be a null-terminated string prefixed by a namespace identifier and a dot character. [...]

The user namespace has no restrictions with regard to naming or contents. The system namespace is primarily used by the kernel for access control lists. The security namespace is used by SELinux, for example.

In the future, I imagine it'd make sense to apply for new namespaces for common annotation/structure needs, too. But for now, it's "user." for what we're doing here.

pjotrek-b commented 1 month ago

I would NOT prefix by app.

The actual naming (syntax) of attribute keys is (still) a good question.

I'd actually suggest to mix-and-match professionally. For example, for common properties, I'd check if there's an existing (standard) way of naming it.

I'd map common fields to existing popular/standard terms:

See Universal File System Extended Attributes Namespace (by Francois Revol / Haiku BFS) for additional information and examples regarding naming.

MacOS uses a reverse-DNS-like notation (like Java classes or RDF), which seems noisy at first - but makes sense over time.

So for custom properties, I'd rather suggest an "origin domain" prefix than app-name: user.com.ahalodeck.awesomeness = 100+

That's actually the beauty of this: It's a mix-and-match and then filter/map on demand.

pjotrek-b commented 1 month ago

A good question is the string-length of the keynames: because ext4 has a "inode blocksize" limit on the total size of all keys+values to store xattrs.

I'm torn: I think it makes sense to get used to a proper, sustainable wording of keys (see EA-UXA article by Francois above) - but it may also be good to start with something that works on as many filesystems that are common right now (eg ext4 vs btrfs).

So I'm also suggesting "mapping-objects" to easily support (shorter) aliases for keys. (another story)

pjotrek-b commented 1 month ago

btw: I just found that Apache Hadoop's filesystem "HDFS" has an article about xattrs and namespaces in their official docs:

https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-hdfs/ExtendedAttributes.html