OpenIO Proxyd API Reference

Florent Vennetier edited this page Mar 16, 2017 · 25 revisions

Introduction

Welcome to the OpenIO Proxyd API. You can use this API to access the OpenIO's internal services (this is the only way we allow to do so). If you wonder why a proxy exists, please consider reading OpenIO-SDS-Proxy to learn how it appeared, and why it has its actual form.

URL Scheme

Nearly all the URL have the same general form:

  • a prefix describing the protocol flavor (the current prefix is v3.0)
  • the namespace you are tryin gto access. If you don't know what a namespace is, please consider reading more about the OpenIO Object Names. If you don't know what is your namespace, please ask to the person who deployed your OpenIO SDS instance.
  • the module of the proxy, composed of the kind of entity (e.g. container, content, ...) and the action performed (e.g. create, destroy, ...).
  • a query string with some mandatory parameters, and maybe some optional.

Curl example (make sure to replace OPENIO with your OpenIO namespace and PROXY with the real target for your installation).

curl "http://PROXY/v3.0/OPENIO/resource"

Curl example with a typical oio-reset.sh installation.

curl "http://127.0.0.1:6002/v3.0/NS/resource"

Errors

When an error occurs, the status of the HTTP reply will reflect what happened. In addition, the reply's body will carry a JSON object with few details. As an example, here is what happens when destroying a container that is not empty:

POST /v3.0/OPENIO/container/destroy?acct=ACCT&ref=JFS HTTP/1.1
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*
HTTP/1.1 409 Conflict
Server: oio-proxy/master-1.0
Connection: Close
Content-Type: application/json
Content-Length: 93
Transfer-Encoding: identity

{
    "message": "M2 error: HOOK error: Request error: 1 elements still in container",
    "status": 438
}

Agregation of session data

All the services in OpenIO SDS generate access logs with a format that allowing to track the activity of a client session. This is achieved with a well known header whose value is reported on each log line.

The name of this header is X-oio-req-id

Its value is expected to be a string of 32 hexadecimal characters in uppercase. Currently, the value might be any printable string, but we have short-term plans to enforce these rules.

Conscience

Get Namespace Info

Returns the namespace info.

GET /v3.0/${NS}/conscience/info

Sample CLI request:

Example

GET /v3.0/OPENIO/conscience/info HTTP/1.0
Host: 127.0.0.1:6002
Content-Length: 0
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.8.1
Connection: keep-alive
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Keep-Alive
Content-Type: octet/stream
Content-Length: ...

{
    "chunksize": "1048576",
    "data_security": {
        "DUPONETWO": "DUP:distance=1|nb_copy=2",
        "RAIN": "RAIN:k=6|m=2|algo=liber8tion"
    },
    "data_treatments": {},
    "ns": "OPENIO",
    "options": {
        "WORM": "false",
        "automatic_open": "true",
        "meta2_check.put.DISTANCE": "false",
        "meta2_check.put.GAPS": "false",
        "meta2_check.put.SRVINFO": "false",
        "meta2_check.put.STGCLASS": "false",
        "meta2_max_versions": "1",
        "ns_status": "MASTER",
        "service_update_policy": "meta2=NONE|1|1;sqlx=KEEP|1|1|",
        "storage_policy": "TWOCOPIES"
    },
    "storage_class": {
        "PRETTYGOOD": "REASONABLYSLOW,NONE",
        "REASONABLYSLOW": "NONE",
        "SUPERFAST": "PRETTYGOOD,REASONABLYSLOW,NONE"
    },
    "storage_policy": {
        "RAIN": "NONE:RAIN:NONE",
        "SINGLE": "NONE:NONE:NONE",
        "TWOCOPIES": "NONE:DUPONETWO:NONE"
    }
}

URL Parameters

Parameter Value Description
what types Tells the proxy to reply the list of services instead the namespace's options.

List the services types

Returns a JSON array of strings, where each string is a service type known by the target proxy. There is no guarantee on a particular sorting on the list.

GET /v3.0/${NS}/conscience/info?what=types

Example

GET /v3.0/OPENIO/conscience/info?what=types HTTP/1.0
Host: 127.0.0.1:6002
Content-Length: 0
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.8.1
Connection: keep-alive
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Keep-Alive
Content-Type: application/json
Content-Length: ...

[
	"sqlx",
	"oiofs",
	"echo",
	"meta0",
	"meta1",
	"meta2",
	"rawx",
	"rainx",
	"account",
	"rdir"
]

Get Services List

Returns the services list.

GET /v3.0/${NS}/conscience/list

Example

GET /v3.0/OPENIO/conscience/list?type=rawx HTTP/1.0
Host: 127.0.0.1:6002
Content-Length: 0
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.8.1
Connection: keep-alive
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Keep-Alive
Content-Type: application/json
Content-Length: ...

[
    {
        "addr": "127.0.0.1:6009",
        "score": 64,
        "tags": {
            "tag.up": true
        }
    },
    {
        "addr": "127.0.0.1:6008",
        "score": 93,
        "tags": {
            "tag.up": true
        }
    }
]

URL Parameters

Parameter Description
type The service type

Register Service

Registers a service.

POST /v3.0/${NS}/conscience/register

curl -XPOST "http://127.0.0.1:6000/v3.0/OPENIO/conscience/register?type=rawx"

URL Parameters

Parameter Description
type The service type

Deregister Service

Deregisters a service.

POST /v3.0/${NS}/conscience/deregister

URL Parameters

Parameter Description
type The service type

Flush Service

Flushes all the services of a given service.

POST /v3.0/${NS}/conscience/flush

URL Parameters

Parameter Description
type The service type

Lock Service

Locks a service.

POST /v3.0/${NS}/conscience/lock

URL Parameters

Parameter Description
type The service type

Unlock Service

POST /v3.0/${NS}/conscience/unlock

URL Parameters

Parameter Description
type The service type

Directory

Create Reference

Creates a new reference.

POST /v3.0/${NS}/reference/create

URL Parameters

Parameter Description
acct The account name
ref The reference name

Show Reference

Shows a reference infos.

GET /v3.0/${NS}/reference/show

URL Parameters

Parameter Description
acct The account name
ref The reference name

Get Properties

Gets properties for a reference.

POST /v3.0/${NS}/reference/get_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name

Set Properties

Sets properties for a reference.

POST /v3.0/${NS}/reference/set_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name

Delete Properties

Deletes properties for a reference.

POST /v3.0/${NS}/reference/del_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name

Link Service

Links a service to a reference.

POST /v3.0/${NS}/reference/link

URL Parameters

Parameter Description
acct The account name
ref The reference name

Unlink Service

Unlinks a service to a reference.

POST /v3.0/${NS}/reference/unlink

URL Parameters

Parameter Description
acct The account name
ref The reference name

Force Service

Forces a service link to a reference.

POST /v3.0/${NS}/reference/force

URL Parameters

Parameter Description
acct The account name
ref The reference name

Renew Service

Renews a service to a reference.

POST /v3.0/${NS}/reference/renew

URL Parameters

Parameter Description
acct The account name
ref The reference name

Container

Create Container

Creates a new container.

Creating a container is a complex operations completely managed by the proxy:

  • You create a USER with the given name, in the given ACCOUNT.
  • you link a meta2 service to your reference
  • you trigger the container creation on the meta2 service.

This account must exist upon the container creation. Hopefully, you can ask for account autocreation with the help of a special header: x-oio-action-mode: autocreate.

POST /v3.0/${NS}/container/create

URL Parameters

Parameter Description
acct The account name
ref The reference name

Example

POST /v3.0/OPENIO/container/create?acct=ACCT&ref=JFS0 HTTP/1.1
Host: 127.0.0.1:6002
Content-Length: 0
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.8.1
Connection: keep-alive
x-oio-action-mode: autocreate
HTTP/1.1 204 No Content
Server: oio-proxy/master-1.0
Connection: Keep-Alive
Content-Type: application/json
Content-Length: 0

Create several containers

Create several containers with one batch request (currently limited to 100 containers).

POST /v3.0/${NS}/container/create_many

URL Parameters

Parameter Description
acct The account name

Headers Parameters

  • X-oio-action-mode: autocreate

Body

JSON object containing the list of containers and their optional properties. See example below.

Example

POST /v3.0/NS/container/create_many?acct=account1 HTTP/1.1
Host: localhost:6000
User-Agent: curl/7.53.1
Accept: */*
x-oio-action-mode: autocreate
Content-Length: 253
Content-Type: application/x-www-form-urlencoded

{
  "containers": [
    {
      "name": "container1",
      "properties": {"key1": "value1", "key2": "value2"},
      "system": {"sys.m2.quota": 1048576}
    },
    {
      "name": "container2",
      "properties": {"key1": "value1", "key3": "value3"}
    },
    {
      "name": "container3"
    }
  ]
}
HTTP/1.1 200 OK
Server: oio-proxy/master/3.0
Connection: Close
Content-Type: application/json
Transfer-Encoding: identity
Content-Length: 126

{
  "containers": [
    {"name":"container1","status":201,"message":"Created"},
    {"name":"container2","status":201,"message":"Created"},
    {"name":"container3","status":201,"message":"Created"},
  ]
}

Since: 3.3

Show Container

Shows a container infos. The reply will carry the container-wide properties (though this is not the goal of the request, this doesn't cost much and might help to save precious I/O ops later). This is a nice way to check for a container presence.

GET /v3.0/${NS}/container/show

URL Parameters

Parameter Description
acct The account name
ref The reference name

Example

GET /v3.0/OPENIO/container/show?acct=ACCT&ref=JFS HTTP/1.1
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*
HTTP/1.1 204 No Content
Server: oio-proxy/master-1.0
Connection: Close
Content-Type: application/json
Content-Length: 0
X-oio-container-meta-sys-account: ACCT
X-oio-container-meta-sys-m2-ctime: 1447250949
X-oio-container-meta-sys-m2-init: 1
X-oio-container-meta-sys-m2-usage: 1552
X-oio-container-meta-sys-m2-version: 1
X-oio-container-meta-sys-name: 9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F.1
X-oio-container-meta-sys-ns: NS
X-oio-container-meta-sys-type: meta2
X-oio-container-meta-sys-user-name: JFS
X-oio-container-meta-x-schema-version: 1.8
X-oio-container-meta-x-version-main-admin: 5:0
X-oio-container-meta-x-version-main-aliases: 5:0
X-oio-container-meta-x-version-main-chunks: 5:0
X-oio-container-meta-x-version-main-contents: 5:0
X-oio-container-meta-x-version-main-properties: 5:0

List a container

Lists a container

GET /v3.0/${NS}/container/list

URL Parameters

Parameter Description
acct The account name
ref The reference name

Example

In this example, a container named NS/ACCT/JFS has been initially created, then a single content named passwdhas been added. Let's observe what will be the listing output.

The Container's attributes are presented in the reply's headers. The body is a JSON object with two members:

  • objects as an array of (JSON) objects, where each object describes a content present in the container that matches the query filters. You did'nt specified explicit filter but do not notice all the contents of the container? You must know that the list is truncated by default.
  • prefixes as an array of strings, only filled when a delimiter has been specified in the query.
GET /v3.0/OPENIO/container/list?acct=ACCT&ref=JFS HTTP/1.1
Host: 127.0.0.1:6002
Connection: keep-alive
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: python-requests/2.8.1
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Keep-Alive
Content-Type: application/json
Content-Length: 158
Transfer-Encoding: identity
X-oio-container-meta-sys-account: ACCT
X-oio-container-meta-sys-m2-ctime: 1447250949
X-oio-container-meta-sys-m2-init: 1
X-oio-container-meta-sys-m2-usage: 1552
X-oio-container-meta-sys-m2-version: 1
X-oio-container-meta-sys-name: 9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F.1
X-oio-container-meta-sys-ns: NS
X-oio-container-meta-sys-type: meta2
X-oio-container-meta-sys-user-name: JFS
X-oio-list-truncated: false

{
    "objects": [
        {
            "ctime": 1447250996,
            "deleted": false,
            "hash": "8C87E533B7CFBD8B8DAA54B518DB9E3B",
            "name": "passwd",
            "policy": "none",
            "size": 1552,
            "ver": 0
        }
    ],
    "prefixes": []
}

Destroy Container

Destroys a container.

Your container must be empty (no content, no property). You can force the destruction if you know what you are doing, and if you are aware that you can orphan chunks on the disks. You might also ask for apreliminary flush on the data in the container.

POST /v3.0/${NS}/container/destroy

URL Parameters

Parameter Description
acct The account name
ref The reference name
flush Ask for a flush before the destruction. Compatible with force.
force Whatever the items still in the container. Compatible with flush.

Headers Parameters

  • X-oio-action-mode: force synonym of the force option in the query string
  • X-oio-action-mode: flush synonym of the flush option in the query string

Example

Full example when the container is already empty:

POST /v3.0/OPENIO/container/destroy?acct=ACCT&ref=JFS HTTP/1.1
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*
HTTP/1.1 204 No Content
Server: oio-proxy/master-1.0
Connection: Close
Content-Type: application/json
Content-Length: 0

Request with additional options set in the header

POST /v3.0/OPENIO/container/destroy?acct=ACCT&ref=JFS HTTP/1.1
X-oio-action-mode: flush, force
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*

A request with the same options set in the query strinf

POST /v3.0/OPENIO/container/destroy?acct=ACCT&ref=JFS&force=1&flush=1 HTTP/1.1
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*

Get Properties

Gets properties for a container.

POST /v3.0/${NS}/container/get_properties

Explicit properties keys can be passed as a JSON array of strings, in the body. An empty array means all the keys are expected. As corner cases, the JSON values null, 0 or an empty body are all analog to the empty array [].

URL Parameters

Parameter Description
acct The account name
ref The reference name

Example

POST /v3.0/OPENIO/container/get_properties?acct=ACCT&ref=JFS HTTP/1.1
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Close
Content-Type: application/json
Content-Length: 415
Transfer-Encoding: identity

{
    "schema_version": "1.8",
    "sys.account": "ACCT",
    "sys.m2.ctime": "1447250949",
    "sys.m2.init": "1",
    "sys.m2.usage": "1552",
    "sys.m2.version": "1",
    "sys.name": "9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F.1",
    "sys.ns": "NS",
    "sys.type": "meta2",
    "sys.user.name": "JFS",
    "version:main.admin": "5:0",
    "version:main.aliases": "5:0",
    "version:main.chunks": "5:0",
    "version:main.contents": "5:0",
    "version:main.properties": "5:0"
}

Set Properties

Sets properties for a container. You must send a JSON object in the body, with one member for each property you want to set. The member name MUST be prefixed with user. and this prefix will be stored, and finally used to query the parameters later.

POST /v3.0/${NS}/container/set_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name
flush Should the server flush the properties before setting the new set. This is how you REPLACE a whole set of properties.

Example

POST /v3.0/OPENIO/container/set_properties?acct=ACCT&ref=JFS HTTP/1.1
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*
Content-Length: 20
Content-Type: application/x-www-form-urlencoded

{
	"user.key": "value"
}
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Close
Content-Type: application/json
Content-Length: 23
Transfer-Encoding: identity

Delete Properties

Deletes properties for a container. A JSON array of property names (strings) must be passed in the request body. An empty array of strings means deleting all the user properties. Providing no body is an error.

POST /v3.0/${NS}/container/del_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name

Example

POST /v3.0/NS/container/del_properties?acct=ACCT&ref=JFS HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 5
Content-Type: application/x-www-form-urlencoded

["k"]
HTTP/1.1 200 OK
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: 23
Transfer-Encoding: identity

{"127.0.0.1:6008":"OK"}

Touch Container

POST /v3.0/${NS}/container/touch

URL Parameters

Parameter Description
acct The account name
ref The reference name

Example

POST /v3.0/NS/container/touch?acct=ACCT&ref=JFS HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*

HTTP/1.1 204 No Content
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: octet/stream
Content-Length: 0

Dedup Container

POST /v3.0/${NS}/container/dedup

URL Parameters

Parameter Description
acct The account name
ref The reference name

Purge Container

POST /v3.0/${NS}/container/purge

URL Parameters

Parameter Description
acct The account name
ref The reference name

Raw Insert

POST /v3.0/${NS}/container/raw_insert

URL Parameters

Parameter Description
acct The account name
ref The reference name

Raw Update

POST /v3.0/${NS}/container/raw_update

URL Parameters

Parameter Description
acct The account name
ref The reference name

Raw Delete

POST /v3.0/${NS}/container/raw_delete

URL Parameters

Parameter Description
acct The account name
ref The reference name

Content

Create Content

Create the content, register the chunks locations.

POST /v3.0/${NS}/content/create

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Request Headers

  • x-oio-content-meta-length: 1337 the final content length
  • x-oio-content-meta-hash: 00000000000000000000000000000000 the md5 checksum of the content
  • x-oio-content-type: octet/stream the content-type of the content

Response

204 No Content

No body

Example

POST /v3.0/OPENIO/content/create?acct=myaccount&ref=x&path=1 HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 502
Content-Type: application/json
Host: localhost:6002
User-Agent: HTTPie/0.9.2
x-oio-content-meta-length: 1

[
    {
        "hash": "00000000000000000000000000000000",
        "pos": "0",
        "size": 1,
        "url": "http://127.0.0.1:6013/44FA14E39265F5A477DB5D62276A389F9257447BABFDB280C47BDC02CD13F3F6"
    },
    {
        "hash": "00000000000000000000000000000000",
        "pos": "0",
        "size": 1,
        "url": "http://127.0.0.1:6014/78737CD3B8EAC35B49F1269C7DA38C3BEBEEAE4011708CE975F56D56E124DBC3"
    },
    {
        "hash": "00000000000000000000000000000000",
        "pos": "0",
        "size": 1,
        "url": "http://127.0.0.1:6015/C388143441E5FAA105F1125A0FC0AE07D4057874815F9DC0EE87AD35F24F2CBD"
    }
]

HTTP/1.1 204 No Content
Connection: Keep-Alive
Content-Length: 0
Server: oio-proxy/master-1.0

Show Content

Shows a content infos.

GET /v3.0/${NS}/content/show

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Example

GET /v3.0/NS/content/show?acct=ACCT&ref=JFS&path=magic HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: 172
Transfer-Encoding: identity
X-oio-content-meta-chunk-method: plain/bytes
X-oio-content-meta-ctime: 1456269061
X-oio-content-meta-deleted: False
X-oio-content-meta-hash: 272913026300E7AE9B5E2D51F138E674
X-oio-content-meta-hash-method: md5
X-oio-content-meta-id: A2201810782C05003F78AF88791C9BDB
X-oio-content-meta-length: 111
X-oio-content-meta-mime-type: application/octet-stream
X-oio-content-meta-name: magic
X-oio-content-meta-policy: SINGLE
X-oio-content-meta-version: 1456269061267626
X-oio-content-meta-x-k: v

[
    {
        "hash": "272913026300E7AE9B5E2D51F138E674",
        "pos": "0",
        "score": 92,
        "size": 111,
        "url": "http://127.0.0.1:6011/5F3391ABBC8DB3E1D2988987AD5FDB10371A4B4BFBC2BF3BB7AA3E9C84FC8DB3"
    }
]

Delete Content

Deletes a content. The operation removes the

POST /v3.0/${NS}/content/delete

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Example

GET /v3.0/NS/content/show?acct=ACCT&ref=JFS&path=magic HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: 172
Transfer-Encoding: identity
X-oio-content-meta-chunk-method: plain/bytes
X-oio-content-meta-ctime: 1456269061
X-oio-content-meta-deleted: False
X-oio-content-meta-hash: 272913026300E7AE9B5E2D51F138E674
X-oio-content-meta-hash-method: md5
X-oio-content-meta-id: A2201810782C05003F78AF88791C9BDB
X-oio-content-meta-length: 111
X-oio-content-meta-mime-type: application/octet-stream
X-oio-content-meta-name: magic
X-oio-content-meta-policy: SINGLE
X-oio-content-meta-version: 1456269061267626
X-oio-content-meta-x-k: v

[
    {
        "hash": "272913026300E7AE9B5E2D51F138E674",
        "pos": "0",
        "score": 92,
        "size": 111,
        "url": "http://127.0.0.1:6011/5F3391ABBC8DB3E1D2988987AD5FDB10371A4B4BFBC2BF3BB7AA3E9C84FC8DB3"
    }
]

Prepare Content

Prepares a content for creation.

POST /v3.0/${NS}/content/prepare

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Body Parameters

JSON args:

  • size: content length of the data you want to create

Response Headers

  • x-oio-action-mode: autocreate autocreate the specified container

Response Body

JSON

Array of chunks

Example

POST /v3.0/OPENIO/content/prepare?acct=myaccount&ref=x&path=1 HTTP/1.1
Accept: application/json
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 13
Content-Type: application/json
Host: 127.0.0.1:6002
User-Agent: HTTPie/0.9.2
x-oio-action-mode: autocreate

{
    "size": "1"
}
HTTP/1.1 200 OK
Connection: Keep-Alive
Content-Length: 502
Content-Type: application/json
Server: oio-proxy/master-1.0
Transfer-Encoding: identity
X-oio-content-meta-chunk-method: chunk-size
X-oio-content-meta-ctime: 1446125920
X-oio-content-meta-deleted: False
X-oio-content-meta-hash:
X-oio-content-meta-hash-method: md5
X-oio-content-meta-length: 1
X-oio-content-meta-mime-type: octet/stream
X-oio-content-meta-name: 1
X-oio-content-meta-policy: THREECOPIES
X-oio-content-meta-version: 0
X-oio-ns-chunk-size: 1048576

[
    {
        "hash": "00000000000000000000000000000000",
        "pos": "0",
        "size": 1048576,
        "url": "http://127.0.0.1:6013/44FA14E39265F5A477DB5D62276A389F9257447BABFDB280C47BDC02CD13F3F6"
    },
    {
        "hash": "00000000000000000000000000000000",
        "pos": "0",
        "size": 1048576,
        "url": "http://127.0.0.1:6014/78737CD3B8EAC35B49F1269C7DA38C3BEBEEAE4011708CE975F56D56E124DBC3"
    },
    {
        "hash": "00000000000000000000000000000000",
        "pos": "0",
        "size": 1048576,
        "url": "http://127.0.0.1:6015/C388143441E5FAA105F1125A0FC0AE07D4057874815F9DC0EE87AD35F24F2CBD"
    }
]

Get Properties

Gets properties for a content.

POST /v3.0/${NS}/content/get_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Example

POST /v3.0/OPENIO/content/get_properties?acct=ACCT&ref=JFS&path=passwd HTTP/1.1
Host: 127.0.0.1:6002
Content-Length: 0
User-Agent: python-requests/2.8.1
Connection: keep-alive
Accept: */*
Accept-Encoding: gzip, deflate
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Keep-Alive
Content-Type: application/json
Content-Length: 2
Transfer-Encoding: identity
X-oio-content-meta-chunk-method: bytes
X-oio-content-meta-ctime: 1446770822
X-oio-content-meta-deleted: False
X-oio-content-meta-hash: 8C87E533B7CFBD8B8DAA54B518DB9E3B
X-oio-content-meta-hash-method: md5
X-oio-content-meta-length: 1552
X-oio-content-meta-mime-type: octet/stream
X-oio-content-meta-name: passwd
X-oio-content-meta-policy: none
X-oio-content-meta-version: 0

Set Properties

Sets properties for a content.

POST /v3.0/${NS}/content/set_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Example

POST /v3.0/NS/content/set_properties?acct=ACCT&ref=JFS&path=magic HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 9
Content-Type: application/x-www-form-urlencoded

{"k":"v"}
upload completely sent off: 9 out of 9 bytes
HTTP/1.1 204 No Content
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: octet/stream
Content-Length: 0

Delete Properties

Deletes properties for a content. As a JSON array of strings, you can specifiy a set of properties names to be explicitely removed. If an empty array is passed, all the properties are removed, this ishow a FLUSH is implemented. No array at all is an error.

POST /v3.0/${NS}/content/del_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Example

To remove the property named k:

POST /v3.0/NS/content/get_properties?acct=ACCT&ref=JFS&path=magic HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 5
Content-Type: application/x-www-form-urlencoded

["k"]
HTTP/1.1 200 OK
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: 2
Transfer-Encoding: identity
X-oio-content-meta-chunk-method: plain/bytes
X-oio-content-meta-ctime: 1456269061
X-oio-content-meta-deleted: False
X-oio-content-meta-hash: 272913026300E7AE9B5E2D51F138E674
X-oio-content-meta-hash-method: md5
X-oio-content-meta-id: A2201810782C05003F78AF88791C9BDB
X-oio-content-meta-length: 111
X-oio-content-meta-mime-type: application/octet-stream
X-oio-content-meta-name: magic
X-oio-content-meta-policy: SINGLE
X-oio-content-meta-version: 1456269061267626

{}

Touch Content

POST /v3.0/${NS}/content/touch

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Request Spare

Requests spare chunks for a content.

POST /v3.0/${NS}/content/spare

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Copy Content

Copies a content.

POST /v3.0/${NS}/content/copy

URL Parameters

Parameter Description
acct The account name
ref The reference name
path The content name

Services Admin

Get service's stats

POST /v3.0/forward/stats?id=IP:PORT

Ping service

POST /v3.0/forward/ping?id=IP:PORT

Get service's version

POST /v3.0/forward/version?id=IP:PORT

Get service's capabilities

POST /v3.0/forward/handlers?id=IP:PORT

Release service's memory

POST /v3.0/forward/lean-glib?id=IP:PORT

POST /v3.0/forward/lean-sqlx?id=IP:PORT

Abort service

POST /v3.0/forward/kill?id=IP:PORT

Flush service's caches

POST /v3.0/forward/flush?id=IP:PORT

Force a reload of service's caches

POST /v3.0/forward/flush?id=IP:PORT

SQLite Admin

Ping election

Sends a signal to all the replicas of the named base. This will ensure they are joined to the election group. The reply will contain a JSON object where the keys are the members of the election and the values the result of the signal handler.

POST /v3.0/${NS}/admin/ping

Example

POST 'http://127.0.0.1:6002/v3.0/NS/admin/ping?acct=ACCT&ref=JFS&type=meta2&seq=1'
User-Agent: curl/7.40.0
Host: 127.0.0.1:6002
Accept: */*
HTTP/1.1 200 OK
Server: oio-proxy/master-1.0
Connection: Close
Content-Type: application/json
Transfer-Encoding: identity
Content-Length: ...

{
	"127.0.0.1:6010":"OK",
	"127.0.0.1:6009":"OK",
	"127.0.0.1:6008":"OK"
}

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Election Status

Queries each replica of the named base (a.k.a. each member of its election group) to know the base considered for the master. The reply will contain a JSON object where the keys are the members of the election and the values: either the string "OK" if the base considers itself as the master the result of the signal handler, or a JSON object depicting the code and message informing you of an error or a redirection.

POST /v3.0/${NS}/admin/status

Example

POST /v3.0/NS/admin/status?acct=ACCT&ref=JFS&type=meta2&seq=1 HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Server: metacd_http/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: ...
Transfer-Encoding: identity

{
	"127.0.0.1:6009":{"code":"303","msg":"127.0.0.1:6008"},
	"127.0.0.1:6010":{"code":"303","msg":"127.0.0.1:6008"},
	"127.0.0.1:6008":"OK"
}

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Drop Cache

POST /v3.0/${NS}/admin/drop_cache

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Election Sync

For a named base, triggers a resynchronisation of all the replica that are in the SLAVE status.

POST /v3.0/${NS}/admin/sync

Example

POST /v3.0/NS/admin/sync?acct=ACCT&ref=JFS&type=meta2&seq=1 HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Server: metacd_http/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: ...
Transfer-Encoding: identity

{
	"127.0.0.1:6010":"OK",
	"127.0.0.1:6009":"OK",
	"127.0.0.1:6008":{"code":"301","msg":"Request error: not SLAVE"}
}

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Leave Election

Tells each replica of the named base to leave its election and close the base. The output will be a JSON array where the keys are the replica ID, and the values the status of the leave operation.

POST /v3.0/${NS}/admin/leave

Example

POST /v3.0/NS/admin/leave?acct=ACCT&ref=JFS&type=meta2&seq=1 HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Server: metacd_http/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: ...
Transfer-Encoding: identity

{
	"127.0.0.1:6009":"OK",
	"127.0.0.1:6010":"OK",
	"127.0.0.1:6008":"OK"
}

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Election Debug

Queries each replica of the given named base for its status, some internal information of interest, and a short log of the last transitions of the election's finite state machine.

POST /v3.0/${NS}/admin/debug

Example

POST /v3.0/NS/admin/debug?acct=ACCT&ref=JFS&type=meta2&seq=1 HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Server: metacd_http/master/1.0
Connection: Close
Content-Type: octet/stream
Content-Length: ...
Transfer-Encoding: identity

{
	"127.0.0.1:6009":"LEADER [3/3/(null)] 13/0/0/0 [20076305601BD6CF230A05F28A96D801B1B0E72B39A0B3E4CFE925A0A86B0E1E] [9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F.1.meta2]
        P: 127.0.0.1:6009|127.0.0.1:6008|127.0.0.1:6010
        PRELEAD:VER_OK:LEADER
        PRELEAD:VER_OK:PRELEAD
        PRELEAD:USE:PRELEAD
        CANDOK:LIST_OK:PRELEAD
        CANDOK:USE:CANDOK
        CANDREQ:CREATE_OK:CANDOK
        CANDREQ:MASTER_CHANGE:CANDREQ
        LEAVING:LEAVE_OK:NONE
        LEAVING:NODE_LEFT:LEAVING
        LOST:EXIT:LEAVING
        PRELOST:RESYNC_DONE:LOST
        LOST:RESYNC_REQ:PRELOST
        LO",
	"127.0.0.1:6008":"LOST [5/3/127.0.0.1:6009] 14/0/0/0 [20076305601BD6CF230A05F28A96D801B1B0E72B39A0B3E4CFE925A0A86B0E1E] [9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F.1.meta2]
        P: 127.0.0.1:6008|127.0.0.1:6010|127.0.0.1:6009
        PRELOST:VER_OK:LOST
        PRELOST:VER_OK:PRELOST
        PRELOST:MASTER_OK:PRELOST
        CANDOK:LIST_OK:PRELOST
        CANDOK:USE:CANDOK
        CANDOK:USE:CANDOK
        CANDREQ:CREATE_OK:CANDOK
        NONE:NONE:CANDREQ
        LEAVING:LEAVE_OK:NONE
        LEAVING:NODE_LEFT:LEAVING
        LEADER:EXIT:LEAVING
        LEADER:USE:LEADER
        LEADER:USE:LEAD",
	"127.0.0.1:6010":"LOST [4/3/127.0.0.1:6009] 14/0/0/0 [20076305601BD6CF230A05F28A96D801B1B0E72B39A0B3E4CFE925A0A86B0E1E] [9006CE70B59E5777D6BB410C57944812EB05FCDB5BA85D520A14B3051D1D094F.1.meta2]
        P: 127.0.0.1:6010|127.0.0.1:6009|127.0.0.1:6008
        PRELOST:VER_OK:LOST
        PRELOST:VER_OK:PRELOST
        PRELOST:MASTER_OK:PRELOST
        CANDOK:LIST_OK:PRELOST
        CANDREQ:CREATE_OK:CANDOK
        CANDREQ:USE:CANDREQ
        CANDREQ:USE:CANDREQ
        CANDREQ:MASTER_CHANGE:CANDREQ
        LEAVING:LEAVE_OK:NONE
        LEAVING:NODE_LEFT:LEAVING
        LOST:EXIT:LEAVING
        PRELOST:RESYNC_DONE:"
}

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Database Copy

POST /v3.0/${NS}/admin/copy

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

The body must be a JSON string containing the target IP:PORT when the base must be copied.

Example

POST /v3.0/NS/admin/copy?acct=ACCT&ref=JFS&type=meta2&seq=1 HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
Content-Length: 16
Content-Type: application/x-www-form-urlencoded

"127.0.0.1:5999"
HTTP/1.1 200 OK
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: 23
Transfer-Encoding: identity

{"127.0.0.1:6008":"OK"}

Get Database Properties

POST /v3.0/${NS}/admin/get_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Set Database Properties

POST /v3.0/${NS}/admin/set_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Delete Database Properties

POST /v3.0/${NS}/admin/del_properties

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Freeze Database

POST /v3.0/${NS}/admin/freeze

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Enable Database

POST /v3.0/${NS}/admin/enable

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Disable Database

POST /v3.0/${NS}/admin/disable

URL Parameters

Parameter Description
acct The account name
ref The reference name
type Type
seq Seq

Local Proxy management

List local services

Returns a list of services locally registered through the contacted Proxy server.

GET /v3.0/${NS}/local/list

Example

GET /v3.0/OPENIO/local/list HTTP/1.1
Host: 127.0.0.1:6002
User-Agent: curl/7.43.0
Accept: */*
HTTP/1.1 200 OK
Server: oio-proxy/master/1.0
Connection: Close
Content-Type: application/json
Content-Length: 2201
Transfer-Encoding: identity

[
    {
        "addr": "127.0.0.1:6007",
        "ns": "OPENIO",
        "score": 92,
        "tags": {
            "stat.cpu": 96.287129,
            "stat.io": 100.0,
            "stat.space": 81.505277,
            "tag.loc": "hem.oio.vol1",
            "tag.up": true
        },
        "type": "meta1"
    },
...
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.