Uranium
Application Framework
UM.CentralFileStorage.CentralFileStorage Class Reference

Public Member Functions

def store
 
def retrieve
 
def getCentralStorageLocation (cls)
 
def setIsEnterprise
 

Detailed Description

This class stores and retrieves items (files or directories) stored in a location central to all versions of the
application. Its purpose is to provide a way for plug-ins to store big items (files or directories) without having
those big items copied to the new resource directory at every version upgrade.

Each items gets a path ID and a version number by which to identify the individual items. The path ID and version
number combination needs to be unique for an item and together refer to a specific item's contents. When retrieving
the item, the retriever needs to specify the hash of the item that it expects to find, and this hash is checked
before giving up the location of the item. This hash will guard against unauthorised changes to the item. The
plug-in, if properly signed, will then not be surprised by malicious content in that file or directory.

If multiple items need to be moved, it's also possible to add a file called "central_storage.json" to the root
directory of the plugin. This json needs to contain a list, of which each element is a list of 4 elements.
The first element holds the relative path to the item (file or directory), the second is the ID, the third is the
ID of the item and the last item is the hash.

A brief example of such a file:
[
    ["files/VeryLargeFileToStore.big", "very_large_file", "1.0.1", "abcdefghijklmnop"],
    ["relative/path/to/dir", "relative/path/to/dir/in/storage", "1.0.1, "124986978cb21e"]
]

Member Function Documentation

def UM.CentralFileStorage.CentralFileStorage.getCentralStorageLocation (   cls,
  str 
)
Gets a directory to store things in a version-neutral location.
:return: A directory to store things centrally.

The documentation for this class was generated from the following file: