Skip to content

Configuration

Nicolas Himmelmann edited this page Jul 29, 2018 · 10 revisions

Configuration of the framework

Decision Rule JSON

This section explains the layout of the JSON for a matching rule in detail.

{
    "uuid" : "<string>",
    "name" : "<string>",
    "dateCreation" : <integer>,
    "mimetypes" : ["<string>", "<string>", ...],
    "sharingDomain" : <integer>,
    "weekdays" : "<string>,
    "timeStart" : "<integer>:<integer>",
    "timeEnd" : "<integer>:<integer>",
    "context" : 
    { 
        "location" :
        {
            "lat" : <double>,
            "lng" : <double>
        },
        "radius" : <integer>,
        "placetypes" : ["<string>", ...],
        "activity" : "<string>",
        "network" :
        {
            "wifi" : 
            {
                "isWifiConnected" : <boolean>,
                "wifiSsid" : "<string>",
                "timestamp" : <integer>
            },
            "mobile" : 
            {
                "isMobileConnected" : <boolean>,
                "isMobileNetworkFast" : <boolean>,
                "mobileNetworkType" : "<string>",
                "timestamp" : <integer>
            },
            "timestamp" : <integer>
        },
        "noise" :
        {
            "sound_db_thresh" : <integer>,
            "sound_rms_thresh" : <integer>
        }
    },
    "filesize" : <integer>,
    "decisions" : 
    [
        {
            "isSpecific": <boolean>,
            "specificNodeId" : "<string>>,
            "selectedType" : "<string>",
            "minRadius" : <float>,
            "maxRadius" : <float>,
            "minBwUp" : <integer>,
            "minBwDown" : <integer>
        },
        ...
    ],
    "isGlobal" : <integer>,
    "storeMultiple" : <boolean>,
    "replicationFactor" : <integer>
    "delete": <boolean>
}

Explanation of the properties:

  • uuid : This should be a globally unique identifier, e.g. a UUID
  • name : A name for the rule which you can choose freely. Is displayed to the user in the demo app.
  • dateCreation: Unix timestamp in seconds
  • mimetypes: An array of mimetypes (e.g. "image/jpeg"), for which the rule should be applicable.
  • sharingDomain: The sharing domain, under which the rule should be applicable. <1>=private or <0>=public or <-1>=both
  • weekdays: Comma-separated list of weekdays at which the rule is valid. 1=monday, ..., 7=sunday" (e.g. "1,2,3,4,5")
  • timeStart: The starting time, from which the rule is valid (format hh:mm, for example 09:00).
  • timeEnd: The end time, until which the rule is valid (format hh:mm, for example 18:00).
  • context: The definitions of context for the rule. A rule is only valid, if a file is uploaded in these given context conditions. All of the following context type definitions are optional. This means, it is totally fine to only specify a location, or only certain place types.
    • location: Physical location context, based on latitude and longitude values.
      • lat: The latitude of the location point
      • lng: The longitude of the location point
    • radius: The radius in meters around the location, in which the rule is valid.
    • placetypes: A list of place types/categories, in which the rule is valid. Supported types can be found in the PlaceType enumeration vstore.framework.context.types.place.PlaceType.
    • activity: The user activity which must be given so that the rule is valid. Supported types can be found in the ActivityType enumeration vstore.framework.context.types.activity.
    • network: Network context which must be given so that the rule is valid. Only one of the following context types should be set. If both are set, WiFi will be preferred.
      • wifi: A wifi network context
        • isWifiConnected: true, if WiFi is currently connected. false, if not.
        • wifiSsid: The SSID of the wireless network the device is currently connected to.
        • timestamp: The unix timestamp of the acquisition of this wifi context in milliseconds.
      • mobile: A mobile network context
        • isMobileConnected: true, if the device is currently connected to a cellular network.
        • isMobileNetworkFast: true, if the cellular network is fast (e.g. > 2G).
        • mobileNetworkType: The type of the cellular network the device is currently connected to (e.g. 2G, 3G, 3.5G, 4G)
        • timestamp: The unix timestamp of the acquisition of this cellular context in milliseconds.
      • timestamp: The unix timestamp of the acquisition of this network context in milliseconds.
    • noise: Definition of a noise context which must be given so that the rule is applicable.
      • sound_db_thresh: The dB threshold for a noise measurement
      • sound_rms_thresh: The RMS threshold for a noise measurement
    • filesize: The minimum size in bytes a file must have so that the rule can be applied to it.
    • decisions: An array of decision layers, which are evaluated once a rule is executed.
      • isSpecific: true, if a file should be placed on a specific node when this decision layer is evaluated.
      • specificNodeId: Only relevant, if isSpecific is set to true. In this case, it specifies the identifier of the specific storage node.
      • selectedType: The type of the target storage node of this decision layer (for supported types, see the NodeType enumeration in vstore.framework.node.NodeType).
      • minRadius: The minimum radius, inside which a target node must be located (around the location of the context) that was given at the time the file was stored.
      • maxRadius: The maximum radius, inside which a target node is allowed to be located (around the location of the context) that was given at the time the file was stored.
      • minBwUp: The minimum upstream bandwidth of the target node in MBit/s.
      • minBwDown: The minimum downstream bandwidth of the target node in MBit/s.
    • isGlobal: true, if the rule is a globally system-defined rule (not user-editable). false, if the rule should be editable by the user.
    • storeMultiple: true, if the framework should store a file, which was matched using this rule, on multiple storage nodes based on the decision layers. false, if only one node should be used.
    • replicationFactor: The maximum number of replication for a file placed using this rule and its decision layers.
    • delete: true, if this rule should be deleted from a device once it reads the JSON configuration. false, if not.
Clone this wiki locally