File: put_dynamic_obj_manifest.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (41 lines) | stat: -rw-r--r-- 2,196 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
module Fog
  module OpenStack
    class Storage
      class Real
        # Create a new dynamic large object manifest
        #
        # Creates an object with a +X-Object-Manifest+ header that specifies the common prefix ("<container>/<prefix>")
        # for all uploaded segments. Retrieving the manifest object streams all segments matching this prefix.
        # Segments must sort in the order they should be concatenated. Note that any future objects stored in the container
        # along with the segments that match the prefix will be included when retrieving the manifest object.
        #
        # All segments must be stored in the same container, but may be in a different container than the manifest object.
        # The default +X-Object-Manifest+ header is set to "+container+/+object+", but may be overridden in +options+
        # to specify the prefix and/or the container where segments were stored.
        # If overridden, names should be CGI escaped (excluding spaces) if needed (see {Fog::OpenStack.escape}).
        #
        # @param container [String] Name for container where +object+ will be stored. Should be < 256 bytes and must not contain '/'
        # @param object [String] Name for manifest object.
        # @param options [Hash] Config headers for +object+.
        # @option options [String] 'X-Object-Manifest' ("container/object") "<container>/<prefix>" for segment objects.
        #
        # @raise [Fog::OpenStack::Storage::NotFound] HTTP 404
        # @raise [Excon::Errors::BadRequest] HTTP 400
        # @raise [Excon::Errors::Unauthorized] HTTP 401
        # @raise [Excon::Errors::HTTPStatusError]
        #
        # @see http://docs.openstack.org/api/openstack-object-storage/1.0/content/dynamic-large-object-creation.html
        def put_dynamic_obj_manifest(container, object, options = {})
          path = "#{Fog::OpenStack.escape(container)}/#{Fog::OpenStack.escape(object)}"
          headers = {'X-Object-Manifest' => path}.merge(options)
          request(
            :expects => 201,
            :headers => headers,
            :method  => 'PUT',
            :path    => path
          )
        end
      end
    end
  end
end