DVFS Metadata

Waldo Bastian bastian at kde.org
Wed Mar 9 12:55:28 EET 2005


On Wednesday 09 March 2005 00:48, nf2 wrote:
> I wonder whether DVFS should use "weak types" (Variants) for *all*
> variables (like metadata, callbackdata, open options, dir-entries,...).
>
> Convenience functions like get_size(metaData) could help to
> compose/decompose those structures on the client *and* backend side...

In KIO we use three types of meta-data.

1) For directory listings and "stat()" kind of functionality KDE returns a 
list of atoms (UDSAtom) for each file. This contains basic information like 
size, ownership, last modified, etc. This uses a type indicator followed by 
binary data of the indicated type. The basic types are basically string and 
number (64-bit). Everything else can be mapped on that. KDE started with 
32-bit numbers, so at one point we had to do some magic to extend that to 
64-bit in a compatible way, but DVFS can do that right from the start.

Apart from the predetermined types KDE allows for protocol dependent custom 
types using the UDS_EXTRA field. A backend for accessing CVS could for 
example add custom fields like "Current Revision" here.

2) In addition to that KDE has metadata that affects for the operation itself. 
It can control things like caching behavior, authentication, has information 
about which window the operation relates to and can contain protocol specific 
configuration information. These use a free form "key" - "value" format.

3) The third kind of meta-data is at the document level, it provides 
information about a specific file and the information that it provides 
depends on the file type, e.g. author of the document, dimensions and 
bit-depth of an image. It can also contain a preview of the document.
Conceptually you could see this as an extension of 1) but since it is much 
more expensive to extract this information it makes sense to keep 1) and 3) 
separate.

For 1) KDE uses the following:

  /**
   * Constants used to specify the type of a KUDSAtom.
   */
  enum UDSAtomTypes {
    /// First let's define the item types
    UDS_STRING = 1,
    UDS_LONG = 2,
    UDS_TIME = 4 | UDS_LONG,

    // To add new UDS entries below, you can use a step of 8
    // (i.e. 8, 16, 24, 32, etc.) Only the last 3 bits are a bitfield,
    // the rest isn't.

    /// Size of the file
    UDS_SIZE = 8 | UDS_LONG,
    UDS_SIZE_LARGE = 32768 | UDS_LONG, // For internal use only
    /// User ID of the file owner
    UDS_USER = 16 | UDS_STRING,
    /// Name of the icon, that should be used for displaying.
    /// It overrides all other detection mechanisms
    /// @since 3.2
    UDS_ICON_NAME = 24 | UDS_STRING,
    /// Group ID of the file owner
    UDS_GROUP =	32 | UDS_STRING,
    /// Extra data (used only if you specified Columns/ColumnsTypes)
    /// This is the only UDS entry that can be repeated.
    /// @since 3.2
    UDS_EXTRA = 48 | UDS_STRING,
    /// Filename - as displayed in directory listings etc.
    /// "." has the usual special meaning of "current directory"
    UDS_NAME = 64 | UDS_STRING,
    /// A local file path if the ioslave display files sitting
    /// on the local filesystem (but in another hierarchy, e.g. media:/)
    UDS_LOCAL_PATH = 72 | UDS_STRING,

    // available: 80, 88, 92, 100, 108 etc.

    /// Access permissions (part of the mode returned by stat)
    UDS_ACCESS = 128 | UDS_LONG,
    /// The last time the file was modified
    UDS_MODIFICATION_TIME = 256 | UDS_TIME,
    /// The last time the file was opened
    UDS_ACCESS_TIME = 512 | UDS_TIME,
    /// The time the file was created
    UDS_CREATION_TIME = 1024 | UDS_TIME,
    /// File type, part of the mode returned by stat
    /// (for a link, this returns the file type of the pointed item)
    /// check UDS_LINK_DEST to know if this is a link
    UDS_FILE_TYPE = 2048 | UDS_LONG,
    /// Name of the file where the link points to
    /// Allows to check for a symlink (don't use S_ISLNK !)
    UDS_LINK_DEST = 4096 | UDS_STRING,
    /// An alternative URL (If different from the caption)
    UDS_URL = 8192 | UDS_STRING,
    /// A mime type; prevents guessing
    UDS_MIME_TYPE = 16384 | UDS_STRING,
    /// A mime type to be used for displaying only.
    /// But when 'running' the file, the mimetype is re-determined
    UDS_GUESSED_MIME_TYPE = 16392 | UDS_STRING,
    /// XML properties, e.g. for WebDAV
    /// @since 3.1
    UDS_XML_PROPERTIES = 32768 | UDS_STRING
  };

The metadata entries that KDE uses for 2) can be found here:
http://webcvs.kde.org/*checkout*/kdelibs/kio/DESIGN.metadata

Cheers,
Waldo
-- 
bastian at kde.org   |   Free Novell Linux Desktop 9 Evaluation Download
bastian at suse.com  |   http://www.novell.com/products/desktop/eval.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/xdg/attachments/20050309/3aa960be/attachment.pgp 


More information about the xdg mailing list