Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
The Nodes

Nodes

There are 2 kind of nodes: The WsFileNode that represents a file and the WsDirNode that represents a directory. The WsFileNode has the following properties:

The WsDirNode has the following properties:

Content element configuration

Each directory and file can have a config file. For directories, the config file is named properties.json and located under the .config subdirectory. For files, the config file has the same name with the .json extension appended, and is located under the .config/nodes subdirectory of its parent directory:

Sort Number

For the sort order based on the sort number: The sort number is read by the parser and put into the properties. Each time the FileSystemTree ends browsing a directory, (the endChild method is called), the FileSystemTree calls the sort() method of the current Node. The sort method tests if the sort flag is set to true. If so, the fileVect and dirVect is sorted based on the sort number. The combinedVect is created and sorted also. For intance:

The sorted vector will contain the Nodes is this order

[Node5, Node3, Node1, Node4, Node2]

Node edition

It is possible to edit a Node configuration or contents (ie. contents of the file represented by the node). When a node is going to be edited, the methods WsUser::getLock() should be called prior to that. This method will check for a current lock and if it does not found any, it will create a lock file in .config/locks/ . The file will be named following this pattern filename.ext.json. The file contains the UID of the editor and a the current timestamp in ms. The lock is valid for 30 min (this value is configurable in config file WsGlobalConfig). After the timeout the lock will be dropped.