FOSSology  4.4.0
Open Source License Compliance by Open Source Software
adj2nest

Working of adj2nest

Convert an adjacency list to a nested set and update user permissions to the upload. Ununpack creates an adjacency list: every child knows it's parent.

For performance: convert this to nested set.

  P1
  /\
C1  C2

C1 is placed in set 1. C2 is placed in set 2. P1 is placed in set 3 – P1 tree spans sets 1-3.

All sets are ordered, so every parent knows the range of sets that form every child.

Method:

  • Select all keys and parents from uploadtree where they are in the upload_fk.
  • Build a tree that changes "child knows parent" to "parent knows child".
  • Walk the tree. (depth-first)
    • Create every set number.
      • Track the left by counting down the tree.
      • Track the right by counting each visited node.
    • Update the DB.

Supported actions

Command line flag Description
-h Help (print this message), then exit
-i Initialize the database, then exit
-a Run on ALL uploads that have no nested set records
-c SYSCONFDIR Specify the directory for the system configuration
-v Verbose (-vv = more verbose)
-u list all upload ids, then exit
no file Process upload ids from the scheduler
id Process upload ids from the command-line
-V Print the version info, then exit

NOTE:

The first id is "1", not "0". Every node is assumed to have a NULL child!

  • If there are n nodes, then the top-most range is [1,2*n]
  • Every left and every right value is unique.
  • The left part of the range is the same as the node's ID number.

Agent source