#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <sys/time.h>
#include "Python.h"
#include "tuple.h"
Go to the source code of this file.
Data Structures | |
struct | CtxObject |
Python object, wrapper for a struct context. More... | |
Defines | |
#define | SETENV_STRING |
Functions | |
PyObject * | ctx_getattr (CtxObject *obj, char *name) |
PyObject * | new_ctx (PyObject *self, PyObject *args) |
void | ctx_dealloc (PyObject *self) |
tuple * | PyTuple_to_LinuxTuple (PyObject *pytup, int puttable) |
Pack a Python tuple into a Linuxtuples tuple. More... | |
PyObject * | LinuxTuple_to_PyTuple (struct tuple *t) |
Unpack a Linuxtuples tuple and convert it to a Python tuple. More... | |
PyObject * | ctx_put_tuple (PyObject *self, PyObject *args) |
PyObject * | ctx_get_read (CtxObject *pyctx, PyObject *args, struct tuple *(*func)(struct tuple *, struct context *), int blocking) |
PyObject * | ctx_get_tuple (PyObject *self, PyObject *args) |
PyObject * | ctx_read_tuple (PyObject *self, PyObject *args) |
PyObject * | ctx_get_nb_tuple (PyObject *self, PyObject *args) |
PyObject * | ctx_read_nb_tuple (PyObject *self, PyObject *args) |
PyObject * | ctx_dump_tuple_space (PyObject *self, PyObject *args) |
PyObject * | ctx_tuple_server_log (PyObject *self, PyObject *args) |
PyObject * | py_random_int (PyObject *self, PyObject *args) |
void | initlinuxtuples (void) |
Initialization function for the module _must_ be called initlinuxtuples. More... | |
Variables | |
staticforward PyTypeObject | CtxType |
char | ctx_put_doc_string [] |
char | ctx_get_doc_string [] |
char | ctx_read_doc_string [] |
char | ctx_get_nb_doc_string [] |
char | ctx_read_nb_doc_string [] |
char | ctx_dump_doc_string [] |
char | ctx_log_doc_string [] |
PyMethodDef | linuxtuples_methods [] |
List of functions defined in the linuxtuples module. More... | |
PyMethodDef | ctx_methods [] |
char | py_random_int_doc_string [] |
char | linuxtuples_doc_string [] |
char | ctx_doc_string [] |
char | new_ctx_doc_string [] |
The best documentation for this is to look at the examples provided in the Python source code for how to extend the language with modules and objects. The 1.5.2 codebase is easy to read; look for xxobject.c and xxmodule.c.
Definition in file py_linuxtuples.c.
|
Value: "\nUnable to find the environment variables (LINUXTUPLES_HOST,\n" \ "LINUXTUPLES_PORT). Please set them." Definition at line 163 of file py_linuxtuples.c. Referenced by new_ctx. |
|
Definition at line 199 of file py_linuxtuples.c. References CtxObject::ctx, and context::sock. |
|
Definition at line 517 of file py_linuxtuples.c. References CtxObject::ctx, dump_tuple_space, LinuxTuple_to_PyTuple, tuple_list::next, PyTuple_to_LinuxTuple, and tuple_list::tup. |
|
Definition at line 482 of file py_linuxtuples.c. References ctx_get_read. |
|
Definition at line 383 of file py_linuxtuples.c. References CtxObject::ctx, destroy_tuple, LinuxTuple_to_PyTuple, and PyTuple_to_LinuxTuple. Referenced by ctx_get_nb_tuple, ctx_get_tuple, ctx_read_nb_tuple, and ctx_read_tuple. |
|
Definition at line 447 of file py_linuxtuples.c. References ctx_get_read. |
|
Definition at line 154 of file py_linuxtuples.c. References ctx_doc_string, and ctx_methods. |
|
Definition at line 344 of file py_linuxtuples.c. References CtxObject::ctx, destroy_tuple, put_tuple, and PyTuple_to_LinuxTuple. |
|
Definition at line 500 of file py_linuxtuples.c. References ctx_get_read. |
|
Definition at line 465 of file py_linuxtuples.c. References ctx_get_read. |
|
Definition at line 605 of file py_linuxtuples.c. References CtxObject::ctx, and tuple_server_log. |
|
Initialization function for the module _must_ be called initlinuxtuples.
Definition at line 649 of file py_linuxtuples.c. References CtxType, linuxtuples_doc_string, and linuxtuples_methods. |
|
Unpack a Linuxtuples tuple and convert it to a Python tuple.
Definition at line 292 of file py_linuxtuples.c. References element::data, tuple::elements, tuple::num_elts, and element::tag. Referenced by ctx_dump_tuple_space, and ctx_get_read. |
|
Definition at line 178 of file py_linuxtuples.c. References CtxObject::ctx, CtxType, get_server_portnumber, and SETENV_STRING. |
|
Definition at line 624 of file py_linuxtuples.c. References random_int. |
|
Pack a Python tuple into a Linuxtuples tuple.
If it's for a PUT, do not permit '?' wildcards. But they're OK for GET and READ templates. Definition at line 236 of file py_linuxtuples.c. References element::data, tuple::elements, I_AM_A_TUPLE, tuple::num_elts, tuple::string_length, tuple::string_space, element::tag, and tuple::tag. Referenced by ctx_dump_tuple_space, ctx_get_read, and ctx_put_tuple. |
|
Initial value: "This is a connection to a tuple server. Its methods give access to\n" "tuple space.\n" "\n" "The put(tuple) method lets you put a tuple into the tuple space.\n" "get(template) removes a tuple that matches the template (where None is\n" "used as a wildcard), blocking until a matching tuple becomes\n" "available. read(template) is like get(), but it returns a copy of the\n" "tuple, leaving the original in tuple space.\n" "\n" "get_nonblocking() and read_nonblocking() are non-blocking versions of\n" "get() and read(), which return None if a matching tuple is not\n" "available.\n" "\n" "The dump() method returns a list of the tuples in tuple space. If\n" "supplied with a list of templates as an argument, it will return a\n" "list of only those tuples that match at least one template.\n" "\n" "The log() method prints a running log of tuple server activity to\n" "stdout. It should be called in a \"while 1:\" loop." Definition at line 107 of file py_linuxtuples.c. Referenced by ctx_getattr. |
|
Initial value: "tuple_list = conn.dump( [template_list] )\n" "Return a list of the tuples in the tuple space. If no template\n" "list is given, return all the tuples. If there is a template\n" "list, return only the tuples that match at least one template." Definition at line 506 of file py_linuxtuples.c. |
|
Initial value: "tuple = conn.get(template)\n" "Get a tuple from tuple space. Items in the returned tuple\n" "must match any non-None items in the template. Nones are\n" "wildcards. This call blocks until a matching tuple is found." Definition at line 436 of file py_linuxtuples.c. |
|
Initial value: "tuple = conn.get_nonblocking(template)\n" "Get a tuple from tuple space. Items in the returned tuple\n" "must match any non-None items in the template. Nones are\n" "wildcards. If no matching tuple is found, returns None." Definition at line 471 of file py_linuxtuples.c. |
|
Initial value: "Dump a continuous log of tuple space activity to stdout. Call this\n" "method in a \"while 1:\" loop. Looping in Python rather than C\n" "means that you can break out of the loop easily with control-C,\n" "and you can put other code in the loop." Definition at line 594 of file py_linuxtuples.c. |
|
Initial value: { {"put", ctx_put_tuple, METH_VARARGS, ctx_put_doc_string}, {"get", ctx_get_tuple, METH_VARARGS, ctx_get_doc_string}, {"read", ctx_read_tuple, METH_VARARGS, ctx_read_doc_string}, {"get_nonblocking", ctx_get_nb_tuple, METH_VARARGS, ctx_get_nb_doc_string}, {"read_nonblocking", ctx_read_nb_tuple, METH_VARARGS, ctx_read_nb_doc_string}, {"dump", ctx_dump_tuple_space, METH_VARARGS, ctx_dump_doc_string}, {"log", ctx_tuple_server_log, METH_VARARGS, ctx_log_doc_string}, {NULL, NULL, 0, NULL} } Definition at line 132 of file py_linuxtuples.c. Referenced by ctx_getattr. |
|
Initial value: "conn.put(tuple)\n" "Put a tuple into tuple space." Definition at line 336 of file py_linuxtuples.c. |
|
Initial value: "tuple = conn.read(template)\n" "Read a copy of a tuple from tuple space. Items in the\n" "returned tuple must match any non-None items in the template.\n" "Nones are wildcards. This call blocks until a matching\n" "tuple is found." Definition at line 453 of file py_linuxtuples.c. |
|
Initial value: "tuple = conn.read_nonblocking(template)\n" "Read a copy of a tuple from tuple space. Items in the\n" "returned tuple must match any non-None items in the template.\n" "Nones are wildcards. If no matching tuple is found, returns\n" "None." Definition at line 488 of file py_linuxtuples.c. |
|
Initial value: { PyObject_HEAD_INIT(NULL) 0, "Ctx", sizeof(CtxObject), 0, ctx_dealloc, 0, (getattrfunc) ctx_getattr, 0, 0, 0, 0, 0, 0, 0, } Definition at line 209 of file py_linuxtuples.c. Referenced by initlinuxtuples, and new_ctx. |
|
Initial value: "This is the Python client API for the linuxtuples tuple server. The\n" "connect() method returns a connection to the tuple server. The\n" "random() method returns a 32-bit integer taken from /dev/urandom." Definition at line 100 of file py_linuxtuples.c. Referenced by initlinuxtuples. |
|
Initial value: { {"connect", new_ctx, METH_VARARGS, new_ctx_doc_string}, {"random", py_random_int, METH_VARARGS, py_random_int_doc_string}, {NULL, NULL} }
Definition at line 637 of file py_linuxtuples.c. Referenced by initlinuxtuples. |
|
Initial value: "conn = connect()\n" "conn = connect(int)\n" "Return a connection to the tuple server." Definition at line 169 of file py_linuxtuples.c. |
|
Initial value: "Return a 32-bit random integer, taken from /dev/urandom." Definition at line 616 of file py_linuxtuples.c. |