Uploaded image for project: 'Help-Desk'
  1. Help-Desk
  2. HELP-5723

FIWARE.Question.Tech.Cloud.ObjectStorage.Storing data in FIWARE Object Storage

    Details

      Description

      Created question in FIWARE Q/A platform on 21-01-2016 at 02:01
      Please, ANSWER this question AT http://stackoverflow.com/questions/34913825/storing-data-in-fiware-object-storage

      Question:
      Storing data in FIWARE Object Storage

      Description:
      I'm building an application that stores files into the FIWARE Object Storage. I don't quite understand what is the correct way of storing files into the storage.

      The code python code snippet below taken from the Object Storage - User and Programmers Guide shows 2 ways of doing it:

      def store_text(token, auth, container_name, object_name, object_text):
      headers =

      {"X-Auth-Token": token}
      1. 1. version
        #body = '{"mimetype":"text/plain", "metadata":{}, "value" : "' + object_text + '"}'
      1. 2. version
        body = object_text

      url = auth + "/" + container_name + "/" + object_name

      return swift_request('PUT', url, headers, body)

      The 1. version confuses me, because when I first looked at the only Node.js module (repo: fiware-object-storage) that works with Object Storage, it seemed to use 1. version. As the module was making calls to the old (v.1.1) API version instead of the presumably newest (v.2.0), referencing to the python example, not sure if that is an outdated version of doing it or not.

      As I played more with the module, realised it didn't work and the code for it was a total mess. So I forked the project and quickly understood that I will need rewrite it form the ground up, taking the above mention python example from the usage guide as an reference. Link to my repo.

      As of writing this the only methods that aren't implement is the object storage (PUT) and object fetching (GET).

      Had some addition questions about the Object Storage which I sent to fiware-lab-help@lists.fiware.org, but haven't heard anything back so asking them here.

      Haven't got much experience with writing API libraries. Should I need to worry about auth token expiring? I presume it is not needed to make a new authentication, every time we interact with storage. The authentication should happen once when server is starting-up (we create a instance) and it internally keeps it. Should I implement some kind of mechanism that refreshes the token?
      Does the tenant id change? From the quote below is presume that getting a tenant I just a one time deal, then later you can use it in the config to make less authentication calls.

      A valid token is required to access an object store. This section
      describes how to get a valid token assuming an identity management
      system compatible with OpenStack Keystone is being used. If the
      username, password and tenant details are known, only step 3 is
      required. source

      During the authentication when fetching tenants how should I select the "right" one? For now i'm just taking the first one similar as the example code does.
      Is it true that a object storage container belongs to only a single region?

        Activity

        Hide
        backlogmanager Backlog Manager added a comment -

        2016-01-21 03:05|CREATED monitor | # answers= 0, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2016-01-21 03:05|CREATED monitor | # answers= 0, accepted answer= False
        Hide
        backlogmanager Backlog Manager added a comment -

        2016-01-24 00:05|UPDATED status: transition Finish| # answers= 1, accepted answer= False

        Show
        backlogmanager Backlog Manager added a comment - 2016-01-24 00:05|UPDATED status: transition Finish| # answers= 1, accepted answer= False

          People

          • Assignee:
            meth Kalman Meth
            Reporter:
            backlogmanager Backlog Manager
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: