Skip to content

Commit

Permalink
fixed some typos in committed datattype doc
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey committed Feb 4, 2015
1 parent ff1d8ec commit 7499d54
Show file tree
Hide file tree
Showing 9 changed files with 114 additions and 24 deletions.
4 changes: 3 additions & 1 deletion docs/Authorization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
Authorization
*************************

TBD
Authorization will be implemented in a future release of h5serv. For this release any
requestor can perform any operation (e.g. ``DELETE /``). Therefor this software should
only be used in non-production environments or on a secure network.
21 changes: 20 additions & 1 deletion docs/CommonErrorResponses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,23 @@
Common Error Responses
***************************

TBD
For each request, h5serv returns a standard HTTP status code as described below.
In general 2xx codes indicate success, 3xx codes some form of redirection, 4xx codes
client error, and 5xx codes for server errors. In addition to the numeric code, h5serv
will return an informational message as part of the response providing further
information on the nature of the error.

* ``200 OK`` - The request was completed successfully
* ``201 Created`` - The request was fulfilled and a new resource (e.g. group, dataset,
attribute was created)
* ``400 Bad Request`` - The request was not structured correctly (e.g. a required key
was missing).
* ``404 Not Found`` - The requested resource was not found (e.g. ``GET /groups/<id>`` where
<id> was not a valid identifier for a group in the domain).
* ``409 Conflict`` - This error is used with PUT requests where the resources cannot
be created because there is an existing resource with the same name (e.g. PUT / where
the requested domain is already present).
* ``410 Gone`` - The resource requested has been recently deleted.
* ``500 Internal Error`` - An unexpected error that indicates some problem occurred on
the server.
* ``501 Not Implemented`` - The request depends on a feature that is not yet implemented.
13 changes: 12 additions & 1 deletion docs/CommonRequestHeaders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@
Common Request Headers
***********************

TBD
The following describe common HTTP request headers as used in h5serv:

* Request line: The first line of the request, the format is of the form HTTP verb (GET,
PUT, DELETE, or POST) followed by the path to the resource (e.g. /group/<uuid>. Some
operations take one or more query parameters (see relevant documentation).

* Authorization: A string that provides the requester's credentials for the request. *Note:*
currently authorization is not implemented and presence or absence of the line will have
no effect.

* Host: the domain (i.e. related collection of groups, datasets, and attributes) that
the request should apply to.
15 changes: 14 additions & 1 deletion docs/CommonResponseHeaders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,17 @@
Common Response Headers
***************************

TBD
The following describes some of the common response lines returned by h5serv.

* Status Line: the first line of the ressponse will always by: "``HTTP/1.1``" followed by
a status code (e.g. 200) followed by a reason message (e.g. "``OK``"). For errors,
an additional error message may be included on this line.

* Content-Length: the response size in bytes.

* Etag: a hash code that indicates the state of the requested resource. If the client
sees the same Etag value for the same request, it can assume the resource has not
changes since the last request.

* Content-Type: the mime type of the response. Currently always "``application/json``".

2 changes: 1 addition & 1 deletion docs/DatasetOps/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Getting information about a dataset
Use the :doc:`GET_Dataset` operation to retrieve information about a datasets type,
shape, and number of attributes. To list all the datasets within a domain use
:doc:`GET_Datasets`. To list the datasets linked to a particular group use
:doc:`../GroupOps/GET_Links`.
:doc:`../GroupOps/GET_Links` and look at links with a "collection" key of "datsets".

Writing data to a dataset
-------------------------
Expand Down
26 changes: 14 additions & 12 deletions docs/DatatypeOps/DELETE_Datatype.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Syntax
------
.. code-block:: http
DELETE /groups/<id> HTTP/1.1
DELETE /datatypes/<id> HTTP/1.1
Host: DOMAIN
Authorization: <authorization_string>
Expand Down Expand Up @@ -61,30 +61,32 @@ Sample Request

.. code-block:: http
DELETE /groups/45a882e1-9d01-11e4-8acf-3c15c2da029e HTTP/1.1
Host: testGroupDelete.test.hdfgroup.org
Authorization: authorization_string
DELETE /datatypes/93b6a335-ac44-11e4-8d71-3c15c2da029e HTTP/1.1
Content-Length: 0
User-Agent: python-requests/2.3.0 CPython/2.7.8 Darwin/14.0.0
host: namedtype_deleted.test.hdfgroup.org
Accept: */*
Accept-Encoding: gzip, deflate
Sample Response
---------------

.. code-block:: http
HTTP/1.1 200 OK
Date: Thu, 15 Jan 2015 21:55:51 GMT
Content-Length: 270
Date: Wed, 04 Feb 2015 08:05:26 GMT
Content-Length: 363
Content-Type: application/json
Server: TornadoServer/3.2.2
.. code-block:: json
{
"hrefs": [
{"href": "http://testGroupDelete.test.hdfgroup.org/groups", "rel": "self"},
{"href": "http://testGroupDelete.test.hdfgroup.org/groups/45a06719-9d01-11e4-9b1c-3c15c2da029e", "rel": "root"},
{"href": "http://testGroupDelete.test.hdfgroup.org/", "rel": "home"}
]
{"href": "http://namedtype_deleted.test.hdfgroup.org/datatypes", "rel": "self"},
{"href": "http://namedtype_deleted.test.hdfgroup.org/", "rel": "home"},
{"href": "http://namedtype_deleted.test.hdfgroup.org/groups/93b51245-ac44-11e4-8a21-3c15c2da029e", "rel": "root"}
]
}
Related Resources
Expand Down
18 changes: 14 additions & 4 deletions docs/DatatypeOps/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@ Committed Datatypes
Committed datatypes (also know as "named types"), are object that describe types. These
types can be used in the creation of datasets and attributes.

Committed datatypes can also contain attributes, to store metadata about the type.
Committed datatypes can be linked to from a Group and can contain attributes, just like
a dataset or group object.

Creating committed datatypes
----------------------------

Use :doc:`POST_Datatype` to create a new datatype. A complete description of the
type must be sent with the POST request.

Getting information about a committed datatype
-----------------------------------------------

Use the :doc:`GET_Datatype` operation to retrieve information about a committed datatype.
To list all the committed datatypes within a domain use
:doc:`GET_Datatypes`. To list the committed types linked to a particular group use
:doc:`../GroupOps/GET_Links` and examine link object with a "collection" key of
"datatypes".

Deleting committed datatypes
----------------------------

Use :doc:`DELETE_Datatype` to delete a datatype. Links from any group to the datatype
will be deleted.

Operations
----------
List of Operations
------------------

.. toctree::
:maxdepth: 3
:maxdepth: 1

DELETE_Datatype
GET_Datatype
Expand Down
24 changes: 21 additions & 3 deletions docs/GroupOps/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,34 @@ Adding Links

Use :doc:`PUT_Link` to create hard, soft, or external links in the group.

Getting information about Groups
--------------------------------

Use :doc:`GET_Group` to get information about a group: attribute count, link count,
creation and modification times.

To retrieve the UUIDs of all the groups in a domain, use :doc:`GET_Groups`.

To retrieve the links of a group use :doc:`GET_Links`. Use :doc:`GET_Link` to get
information about a specific link.

To get a group's attributes, use :doc:`../AttrOps/GET_Attributes`.

Deleting Groups
---------------
Use :doc:`DELETE_Group` to remove a group. All attributes and links of the group
will be deleted.

Operations
----------
*Note:* deleting a group will not delete any objects (datasets or other groups) that the
the group's links points to. These objects may become *anonymous*, i.e. they are not
referenced by any link, but can still be accessed via ``GET`` request with the object
uuid.

List of Operations
------------------

.. toctree::
:maxdepth: 2
:maxdepth: 1

DELETE_Group
DELETE_Link
Expand Down
15 changes: 15 additions & 0 deletions server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,28 @@ def delete(self):
domain = self.request.host
filePath = getFilePath(domain)
verifyFile(filePath, True)
response = { }
hrefs = []
rootUUID = None
try:
with Hdf5db(filePath, app_logger=log) as db:
db.deleteObjectByUuid('datatype', uuid)
rootUUID = db.getUUIDByPath('/')
except IOError as e:
log.info("IOError: " + str(e.errno) + " " + e.strerror)
status = errNoToHttpStatus(e.errno)
raise HTTPError(status, reason=e.strerror)

# got everything we need, put together the response
href = self.request.protocol + '://' + domain + '/'
hrefs.append({'rel': 'self', 'href': href + 'datatypes'})
hrefs.append({'rel': 'home', 'href': href})
hrefs.append({'rel': 'root', 'href': href + 'groups/' + rootUUID})

response['hrefs'] = hrefs

self.set_header('Content-Type', 'application/json')
self.write(json_encode(response))

class DatatypeHandler(RequestHandler):
def getRequestId(self):
Expand Down

0 comments on commit 7499d54

Please sign in to comment.