Skip to content

Content store redesign

Michael Frey edited this page May 17, 2019 · 24 revisions

Introduction

We've started to redesign the content store (CS) on our last hackathon. There are multiple reasons for redesigning the content store:

  • allow to have multiple content stores at once, e.g. for specific prefixes or for long term storage (e.g. a sd-card)
  • reduce the size of the global ccnl_relay_t struct
  • allow to have different types of content store (a hash-map-based content store, a double linked-list, a statically memory-allocated content store (for iot devices), ...)

Design

  • Basically, we provide a ccnl_cs_opt_t struct which contains function pointers to add, remove, lookup functions of a concrete implementation
  • Functions in src/ccnl-cs/src/ccnl_cs.c provide generic checks (parameters are not null, etc.) for the concrete implementation before calling a concrete implementation

Roadmap

  • provide a CS implementation which implements the new CS interface
  • unit tests in test/ccnl-cs should have for every available implementation their own setup/teardown function (where the ccnl_cs_opt_t struct is set with the function pointers of the concrete implementation)
  • integrate the CS redesign into CCN-lite
    • remove the current CS from ccnl_relay_t struct
    • replace calls to the CS in the ccnl_relay_t struct with calls to a new (temporary) global variable

Current status

Development

Development currently takes place in Cenks fork of CCN-lite, to be precise in branch cs_refactoring. The workflow is that you create a branch based on Cenks feature branch and do a PR once you complete a feature of the CS. As soon we are ready to integrate the redesigned CS into CCN-lite Cenk will open a PR to the (main) CCN-lite repository.

Problems & Challenges

  • Prefixes (ccnl_prefix_s) and content (ccnl_contained_s) are not a flat raw byte representation (contrary to the new name (ccnl_cs_name_t) and content (ccnl_cs_content_t) structs, hence we need a mechanism to marshall/unmarshall between these representations
  • The CCN-Lite module for RIOT introduced functions for adding, removing and looking up content. These function clash name-wise with functions defined in ccnl-cs.h

Questions

  • Shall we add a function for dumping the content store to ccnl_cs_opt_t, e.g. dumping to the command line or to a string?
  • Lookup function should provide different comparing modes for prefix
  • The "old" ccnl_content_remove function returns the removed object (?), should investigate if this is still really necessary (the element to be removed is passed to the function in the first place)

Modules

ccnl-fwd.c

ccnl_fwd_handleContent check for duplicate content
ccnl_fwd_handleInterest retrieving content

ccnl-relay.c

ccnl_content_remove
ccnl_content_add2cache
ccnl_content_serve_pending analyze
ccnl_cs_dump print content store done
ccnl_cs_remove2
ccnl_cs_lookup2
ccnl_do_ageing done

ccnl-unix.c

ccnl_relay_config initialization

ccnl-localrpc.c

rpc_cacheRemove removing content from cache

ccnl-mgmt.c

Log

  • removed notion of -1 for max_cache_size as unlimited