Project

General

Profile

CsMgmt » History » Revision 14

Revision 13 (Davide Pesavento, 02/09/2018 02:31 PM) → Revision 14/20 (Junxiao Shi, 02/11/2018 08:49 AM)

# Content Store Management 

 {{>toc}} 

 **Content Store Management** is a module of [[Management|NFD Management protocol]]. 
 It provides commands and datasets about the Content Store and its usage in forwarding. 

 Content Store Management commands and datasets are available under namespace `ndn:/localhost/nfd/cs`. 

 ## Control Commands 

 [[ControlCommand]] **management-module**: `cs` 

 ### Update configuration 

 **command-verb**: `config` 

 This command updates CS configuration. 
 To discover the current configuration, either retrieve the CS Information Dataset, or send an empty `config` command. 

 ControlParameters fields: 

 * Capacity (optional): maximum number of CS entries. 
 * Flags (optional): CS enablement flags (see below). 
 * Mask (optional): MUST be specified if *Flags* is present, and omitted if *Flags* is omitted. 

 *Flags* is the inclusive OR of the following CS enablement flags: 
   1=`CS_ENABLE_ADMIT`, enables the CS to admit new Data. 
   2=`CS_ENABLE_SERVE`, enables the CS to satisfy Interests using cached Data. 
 The initial value of *Flags* in NFD's CS is equivalent to `CS_ENABLE_ADMIT` | `CS_ENABLE_SERVE`. 

 If all fields are omitted, the command has no effect but is still considered successful. 

 If the command succeeds, \<Body> in ControlResponse block contains updated ControlParameters reflecting current configuration: 

 * Capacity (required) 
 * Flags (required) 

 Note to future protocol designers: when the CS is extended to have multiple storage tiers (such as RAM and SSD), ControlParameter shall have an optional *Name* field to indicate the storage tier being configured. 

 ### Erase entries 

 **command-verb**: `erase` 

 This command erases entries from the CS. 

 ControlParameters fields: 

 * Name (required): name prefix to start erasing. 
 * NCsEntries (optional): maximum number of entries to erase, default is 1, minimum is 1. 

 This command causes the forwarder to erase up to *NCsEntries* CS entries under the specified name prefix *Name*. 
 If the command succeeds, \<Body> in ControlResponse block contains updated ControlParameters indicating the result: 

 * Name (required) 
 * Capacity (optional): upper bound of *NCsEntries*, included only when the upper bound is exceeded. 
 * NCsEntries (required): actual number of erased entries. 

 If there are no CS entries under the specified name prefix, the command does nothing but is still considered successful. 

 A forwarder MAY impose an upper bound on *NCsEntries*. This upper bound MUST NOT be zero. If *NCsEntries* in a request exceeds the upper bound, the forwarder erases entries until reaching the upper bound, responds with status code 206, and includes the upper bound in the *Capacity* field of the response body. The current upper bound in NFD is 64 entries. 

 ## CS Information Dataset 

 The CS configuration and runtime performance are published as a [[StatusDataset|Status Dataset]] at `ndn:/localhost/nfd/cs/info`. 

     CsInfo ::= CS-INFO-TYPE TLV-LENGTH 
                  Capacity 
                  Flags 
                  NCsEntries 
                  NHits 
                  NMisses 

     (TLVs have nonNegativeInteger as value) 

 Note to future protocol designers: in CsInfo element, fields that reflect configuration shall be placed before fields that reflect runtime counters. 

 Note to future protocol designers: when the CS is extended to have multiple storage tiers (such as RAM and SSD), each storage tier shall have separate counters, multiple CsInfo elements appear in the dataset and each has a *Name* field as the first child to indicate the storage tier. 

 ## CS Enumeration 

 A subset of CS entries can be queried into a [[StatusDataset|Status Dataset]] under `ndn:/localhost/nfd/cs/query`. 

     CsQuery ::= CS-QUERY-TYPE TLV-LENGTH 
                     Name 
                     PacketSize 
                     FreshnessPeriod 

     (TLVs have nonNegativeInteger as value) 

 ## TLV-TYPE assignments 

 Type                                          | Assigned number     | Assigned number (hex) 
 ------------------------------------------- | ----------------- | --------------------- 
 CsInfo                                        | 128                 | 0x80 
 Capacity                                      | 131                 | 0x83 
 Flags                                         | 108                 | 0x6c 
 NCsEntries                                    | 135                 | 0x87 
 NHits                                         | 129                 | 0x81 
 NMisses                                       | 130                 | 0x82