| // Copyright 2019 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| library fuchsia.io; |
| |
| /// The type to identify a node, if the implementation supports some notion of |
| /// unique node ID. |
| /// |
| /// ## Uniqueness Guarantees |
| /// |
| /// A client is usually presented with a directory tree that is the result |
| /// of composing together multiple backing implementation instances. An ID |
| /// would be unique within the corresponding instance only. |
| /// Their boundaries are rather implicit on Fuchsia, as a result of |
| /// transparently-forwarding directory proxies. It could be common for a client |
| /// to observe identical `Id`s when traversing a directory tree, when it |
| /// encounters nodes from different backing instances. Therefore, the ID is best |
| /// used for debugging and informational purposes. |
| /// |
| /// If the implementation also supports [`fuchsia.fs/Query`], the |
| /// [`fuchsia.fs/FilesystemInfo.fs_id`] field may be used to disambiguate IDs |
| /// from different backing instances. |
| alias Id = uint64; |
| |
| /// Objective information about a filesystem node. |
| /// See [`Node.GetAttributes`] and [`Node.UpdateAttributes`]. |
| /// |
| /// The attributes of a node should be stable, independent of the |
| /// specific protocol used to access it. |
| /// |
| /// If a particular attribute is not applicable or not supported, |
| /// filesystems should leave the corresponding field absent. |
| type NodeAttributes2 = table { |
| /// Describes the kinds of representations supported by the node. |
| /// Note: This is not the result of the connection-time negotiation, |
| /// which is conveyed via `representation`. |
| /// |
| /// This attribute is read-only. |
| 1: protocols NodeProtocols; |
| |
| /// Describes the kinds of operations supported by the node. |
| /// Note: This is distinct from the rights used at connection time. |
| /// |
| /// This attribute is read-only. |
| 2: abilities Abilities; |
| |
| /// Node size, in bytes. |
| /// |
| /// This attribute is read-only. |
| 3: content_size uint64; |
| |
| /// Space needed to store the node (possibly larger than size), in bytes. |
| /// |
| /// This attribute is read-only. |
| 4: storage_size uint64; |
| |
| /// Number of hard links to the node. It must be at least one. |
| /// |
| /// This attribute is read-only. |
| 5: link_count uint64; |
| |
| /// Time of creation in nanoseconds since the Unix epoch, UTC. |
| /// It may be updated manually after creation. |
| 6: creation_time uint64; |
| |
| /// Time of last modification in nanoseconds since the Unix epoch, UTC. |
| 7: modification_time uint64; |
| |
| /// An ID for the node. See [`fuchsia.io2/Id`]. |
| /// This `id` should be unique among all entries of a directory. |
| /// |
| /// This attribute is read-only. |
| 8: id Id; |
| }; |
| |
| /// When calling [`Node.GetAttributes`], set the corresponding bit to one |
| /// to query that particular attribute. |
| /// The elements here correspond one-to-one with [`NodeAttributes`]. |
| type NodeAttributesQuery = strict bits : uint64 { |
| /// Requests [`NodeAttributes.protocols`]. |
| PROTOCOLS = 0x1; |
| |
| /// Requests [`NodeAttributes.abilities`]. |
| ABILITIES = 0x2; |
| |
| /// Requests [`NodeAttributes.content_size`]. |
| CONTENT_SIZE = 0x4; |
| |
| /// Requests [`NodeAttributes.storage_size`]. |
| STORAGE_SIZE = 0x8; |
| |
| /// Requests [`NodeAttributes.link_count`]. |
| LINK_COUNT = 0x10; |
| |
| /// Requests [`NodeAttributes.creation_time`]. |
| CREATION_TIME = 0x20; |
| |
| /// Requests [`NodeAttributes.modification_time`]. |
| MODIFICATION_TIME = 0x40; |
| |
| /// Requests [`NodeAttributes.id`]. |
| ID = 0x80; |
| }; |