Module: CPEE::DStore

Defined in:
lib/cpee-dstore/implementation.rb

Defined Under Namespace

Classes: DoGet, DoPut

Constant Summary collapse

SERVER =
File.expand_path(File.join(__dir__,'implementation.xml'))

Class Method Summary collapse

Class Method Details

.implementation(opts) ⇒ Object

}}}



61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/cpee-dstore/implementation.rb', line 61

def self::implementation(opts)
  opts[:data_dir] ||= File.expand_path(File.join(__dir__,'data'))

  Proc.new do
    on resource do                                                                     # "/"
      on resource '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' do      # uuid
        on resource '[a-z_][a-zA-Z0-9_]*' do                                            # name
          run DoGet, opts[:data_dir] if get
          run DoPut, opts[:data_dir] if put 'file'
        end
      end
    end
  end
end