summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to 'portato')
-rw-r--r--portato/ipc.pyx35
1 files changed, 32 insertions, 3 deletions
diff --git a/portato/ipc.pyx b/portato/ipc.pyx
index 4a06102..e9340cf 100644
--- a/portato/ipc.pyx
+++ b/portato/ipc.pyx
@@ -11,12 +11,21 @@
# Written by René 'Necoro' Neumann <necoro@necoro.net>
class MessageQueueError(Exception):
+ """
+ Base class for different queue errors.
+ """
pass
class MessageQueueRemovedError (MessageQueueError):
+ """
+ This class is used iff the queue is already removed.
+ """
pass
cdef class MessageQueue (object):
+ """
+ A simple interface to the SysV message queues.
+ """
CREAT = IPC_CREAT
EXCL = IPC_EXCL
@@ -25,12 +34,18 @@ cdef class MessageQueue (object):
cdef readonly key_t key
def __init__ (self, key = None, int flags = 0):
+ """
+ Create a new MessageQueue instance. Depending on the passed in flags,
+ different behavior occurs. See man msgget for the details.
+
+ If key is None, a random key is created.
+ """
if (flags & IPC_EXCL) and not (flags & IPC_CREAT):
- raise MessageQueueError("EXCL must be combined with CREAT.")
+ raise ValueError("EXCL must be combined with CREAT.")
if key is None and not (flags & IPC_EXCL):
- raise MessageQueueError("The key can only be None if EXCL is set.")
+ raise ValueError("The key can only be None if EXCL is set.")
# make sure there is nothing ... obscure
flags &= (IPC_CREAT | IPC_EXCL)
@@ -55,11 +70,14 @@ cdef class MessageQueue (object):
elif errno == ENOENT:
raise MessageQueueError("Queue does not exist and CREAT is not set.")
elif errno == ENOMEM or errno == ENOSPC:
- raise MessageQueueError("Insufficient ressources.")
+ raise MemoryError("Insufficient ressources.")
else:
raise OSError(errno, strerror(errno))
def remove (self):
+ """
+ Removes the message queue.
+ """
cdef msqid_ds info
cdef int ret
@@ -74,6 +92,12 @@ cdef class MessageQueue (object):
raise OSError(errno, strerror(errno))
def send (self, message, int type = 1):
+ """
+ Sends a message with a specific type.
+
+ The type must be larger zero.
+ Also note, that this is always blocking.
+ """
cdef msg_data * msg
cdef int ret
cdef long size = len(message)
@@ -109,6 +133,11 @@ cdef class MessageQueue (object):
PyMem_Free(msg)
def receive (self):
+ """
+ Receives a message from the queue and returns the (msg, type) pair.
+
+ Note that this method is always blocking.
+ """
cdef msg_data * msg
cdef int ret
cdef object retTuple
ref='/others/cgit.git/commit/Makefile?h=v0.4&id=dad80d1ff8e065002cdf4e37252164a7f8517a5b&follow=1'>Tag release v0.3v0.3Lars Hjemli1-1/+1 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-11Update README with submodule build infoLars Hjemli1-13/+39 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-11Add submodule links in tree listingLars Hjemli6-12/+27 When a submodule occurs in a tree, generate a link to show the module/commit. The link is specified as a sprintf string in /etc/cgitrc, using parameters 'module-link' and 'repo.module-link'. This should probably be extended with repo.module-link.$path. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-11Add submodules.sh and use it during buildsLars Hjemli3-13/+222 This adds a shell script which can be be used to initialize, list and update submodules in a git repository. It reads the file .gitmodules to find a mapping between submodule path and repository url for the initial clone of all submodules. The script is used during cgit builds to enable automatic download and checkout of the git git repository. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-11Added git as a submoduleLars Hjemli2-1/+1 This commit adds the subdirectory 'git' as a submodule containing the git git repository, but doesn't add support for automatically cloning the submodule. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-09Add support for downloading single blobsLars Hjemli5-3/+47 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-08ui-view: show pathname if specified in querystringLars Hjemli3-5/+10 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-05-08Update to libgit 1.5.2-rc2Lars Hjemli9-837/+50 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-21Layout updateLars Hjemli9-32/+127 2007-02-08Make snapshot feature configurableLars Hjemli5-6/+22 Snapshots can now be enabled/disabled by default for all repositories in cgitrc with param "snapshots". Additionally, any repo can override the default setting with param "repo.snapshots". By default, no snapshotting is enabled. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-08Add support for snapshotsLars Hjemli8-8/+153 Make a link from the commit viewer to a snapshot of the corresponding tree. Currently only zip-format is supported. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-05cgit v0.2v0.2Lars Hjemli1-1/+1 Main changes since v0.1: -list tags in repo summary -allow search in log-view -read repository paths from cgitrc Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-05Add support for prefix and gitsrc arguments to 'make'Lars Hjemli2-15/+37 This should improve the installation a little, especially since the new options are mentioned in the README. Also, add a make-rule to build the git binaries if necessary + a dependency between cgit and libgit.a. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Update cgitrc templateLars Hjemli1-21/+32 Make the descriptions more helpfull. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Add support for lightweight tagsLars Hjemli2-19/+37 There is nothing bad about a tag that has no tag-object, but the old code didn't handle such tags correctly. Fix it. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Read repo-info from /etc/cgitrcLars Hjemli5-55/+120 This makes cgit read all repo-info from the configfile, instead of scanning for possible git-dirs below a common root path. This is primarily done to get better security (separate physical path from logical repo-name). In /etc/cgitrc each repo is registered with the following keys: repo.url repo.name repo.path repo.desc repo.owner Note: *Required keys are repo.url and repo.path, all others are optional *Each occurrence of repo.url starts a new repository registration *Default value for repo.name is taken from repo.url *The value of repo.url cannot contain characters with special meaning for urls (i.e. one of /?%&), while repo.name can contain anything. Example: repo.url=cgit-pub repo.name=cgit/public repo.path=/pub/git/cgit repo.desc=My public cgit repo repo.owner=Lars Hjemli repo.url=cgit-priv repo.name=cgit/private repo.path=/home/larsh/src/cgit/.git repo.desc=My private cgit repo repo.owner=Lars Hjemli Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-04Do not die if tag has no messageLars Hjemli1-2/+2 Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-02-03Fix search for non-virtual urlsLars Hjemli1-0/+6 When cgit don't use virtual urls, the current repo and page url parameters must be included in the search form as hidden input fields. Signed-off-by: Lars Hjemli <hjemli@gmail.com> 2007-01-28Update README with install/config informationLars Hjemli1-24/+28 Signed-off-by: Lars Hjemli <hjemli@gmail.com>