diff options
author | CoprDistGit <infra@openeuler.org> | 2023-06-20 04:55:49 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-06-20 04:55:49 +0000 |
commit | 90cd23d1c8cc1b482232b9a46547ad97c8ee947a (patch) | |
tree | d643db0ef49a83364a008eea15cc0e9101759766 | |
parent | 02a5bd6d67c13d6ffbf15fd78970a561c165aa38 (diff) |
automatic import of python-filebusopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-filebus.spec | 367 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 369 insertions, 0 deletions
@@ -0,0 +1 @@ +/filebus-0.3.5.tar.gz diff --git a/python-filebus.spec b/python-filebus.spec new file mode 100644 index 0000000..7f70392 --- /dev/null +++ b/python-filebus.spec @@ -0,0 +1,367 @@ +%global _empty_manifest_terminate_build 0 +Name: python-filebus +Version: 0.3.5 +Release: 1 +Summary: A user space multicast named pipe implementation backed by a regular file +License: Apache Software License +URL: https://github.com/pipebus/filebus +Source0: https://mirrors.aliyun.com/pypi/web/packages/16/8b/bf68abbf4d301e111e87a09d2f2ce439277219f6a9a9c836533bcaaa86f9/filebus-0.3.5.tar.gz +BuildArch: noarch + +Requires: python3-filelock + +%description +# filebus + +A userspace multicast named pipe implementation, backed by a regular +file, and accessed via a filebus stdio stream. + +## Motivation + +Imagine a stream of binary data like `/dev/urandom` that one wishes +for programs to be able to consume in a multicast fashion. An +obvious solution would be to redirect the binary data to a log file, +and then launch a separate `tail` command for each program that needs to +consume output from the log. However, this is not sustainable because +the log size will eventually grow too large if it is unbounded. + +In order to solve this problem with `filebus`, simply pipe the live +stream to a filebus producer as follows: +``` +strings /dev/urandom | filebus --filename /tmp/urandom.filebus producer +``` + +This command causes the file `/tmp/urandom.filebus` to behave like a +multicast pipe for filebus consumers which are launched like this: +``` +filebus --filename /tmp/urandom.filebus consumer +``` + +## Implementation details + +The on-disk file is updated via atomic rename while a lock is held. +File locking makes it safe for multiple producers to concurrently +produce to the same stream. + +The filebus `--back-pressure` protocol uses deleted files to indicate +consumed buffers. File locking ensures that exactly one +consumer will consume and delete each buffer, and producers will +not attempt to write a new buffer until the previous buffer has been +consumed. A producer writes an empty buffer in order to indicate +EOF, and a consumer will terminate when it reads the empty buffer. + +## Caveats + +The `--back-pressure` option implement a lossless protocol, but this +protocol causes only a single consumer to receive a given buffer. +However, it is possible for an unlimited number of consumers which +are not using the `--back-pressure` option to eavesdrop on this stream +(provided they have been granted file read permission at the OS level), +albeit in a lossy manner. + +In the absence of the `--back-pressure` option, consumers will +certainly lose chunks at high data rates, but lower data rates should +be lossless, and consumers should always be able to observe the most +recent chunk if it has not been quickly replaced by another. + +## Alternative implementations + +The bash implementation currently currently reads newline delimited +chunks, whereas the python implementation uses the `--sleep-interval` +and `--block-size` arguments to delimit chunks. The python +implementation is agnostic to the underlying stream in the sense that +it explicitly does not interpret any stream content as a delimiter, +which is a desirable property for filebus, but not essential for many +use cases. + +## Usage +``` +usage: filebus [-h] [--back-pressure] [--block-size N] + [--impl {bash,python}] [--lossless] [--no-file-monitoring] + [--filename FILE] [--sleep-interval N] [-v] + {producer,consumer} ... + + filebus 0.2.0 + A user space multicast named pipe implementation backed by a regular file + +positional arguments: + {producer,consumer} + producer connect producer side of stream + consumer connect consumer side of stream + +optional arguments: + -h, --help show this help message and exit + --back-pressure enable lossless back pressure protocol (unconsumed + chunks cause producers to block) + --block-size N maximum block size in units of bytes + --impl {bash,python}, --implementation {bash,python} + choose an alternative filebus implementation + (alternative implementations interoperate with + eachother) + --lossless an alias for --back-pressure + --no-file-monitoring disable filesystem event monitoring + --filename FILE path of the data file (the producer updates it via + atomic rename) + --sleep-interval N check for new messages at least once every N + seconds + -v, --verbose verbose logging (each occurence increases + verbosity) +``` + + + + +%package -n python3-filebus +Summary: A user space multicast named pipe implementation backed by a regular file +Provides: python-filebus +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-filebus +# filebus + +A userspace multicast named pipe implementation, backed by a regular +file, and accessed via a filebus stdio stream. + +## Motivation + +Imagine a stream of binary data like `/dev/urandom` that one wishes +for programs to be able to consume in a multicast fashion. An +obvious solution would be to redirect the binary data to a log file, +and then launch a separate `tail` command for each program that needs to +consume output from the log. However, this is not sustainable because +the log size will eventually grow too large if it is unbounded. + +In order to solve this problem with `filebus`, simply pipe the live +stream to a filebus producer as follows: +``` +strings /dev/urandom | filebus --filename /tmp/urandom.filebus producer +``` + +This command causes the file `/tmp/urandom.filebus` to behave like a +multicast pipe for filebus consumers which are launched like this: +``` +filebus --filename /tmp/urandom.filebus consumer +``` + +## Implementation details + +The on-disk file is updated via atomic rename while a lock is held. +File locking makes it safe for multiple producers to concurrently +produce to the same stream. + +The filebus `--back-pressure` protocol uses deleted files to indicate +consumed buffers. File locking ensures that exactly one +consumer will consume and delete each buffer, and producers will +not attempt to write a new buffer until the previous buffer has been +consumed. A producer writes an empty buffer in order to indicate +EOF, and a consumer will terminate when it reads the empty buffer. + +## Caveats + +The `--back-pressure` option implement a lossless protocol, but this +protocol causes only a single consumer to receive a given buffer. +However, it is possible for an unlimited number of consumers which +are not using the `--back-pressure` option to eavesdrop on this stream +(provided they have been granted file read permission at the OS level), +albeit in a lossy manner. + +In the absence of the `--back-pressure` option, consumers will +certainly lose chunks at high data rates, but lower data rates should +be lossless, and consumers should always be able to observe the most +recent chunk if it has not been quickly replaced by another. + +## Alternative implementations + +The bash implementation currently currently reads newline delimited +chunks, whereas the python implementation uses the `--sleep-interval` +and `--block-size` arguments to delimit chunks. The python +implementation is agnostic to the underlying stream in the sense that +it explicitly does not interpret any stream content as a delimiter, +which is a desirable property for filebus, but not essential for many +use cases. + +## Usage +``` +usage: filebus [-h] [--back-pressure] [--block-size N] + [--impl {bash,python}] [--lossless] [--no-file-monitoring] + [--filename FILE] [--sleep-interval N] [-v] + {producer,consumer} ... + + filebus 0.2.0 + A user space multicast named pipe implementation backed by a regular file + +positional arguments: + {producer,consumer} + producer connect producer side of stream + consumer connect consumer side of stream + +optional arguments: + -h, --help show this help message and exit + --back-pressure enable lossless back pressure protocol (unconsumed + chunks cause producers to block) + --block-size N maximum block size in units of bytes + --impl {bash,python}, --implementation {bash,python} + choose an alternative filebus implementation + (alternative implementations interoperate with + eachother) + --lossless an alias for --back-pressure + --no-file-monitoring disable filesystem event monitoring + --filename FILE path of the data file (the producer updates it via + atomic rename) + --sleep-interval N check for new messages at least once every N + seconds + -v, --verbose verbose logging (each occurence increases + verbosity) +``` + + + + +%package help +Summary: Development documents and examples for filebus +Provides: python3-filebus-doc +%description help +# filebus + +A userspace multicast named pipe implementation, backed by a regular +file, and accessed via a filebus stdio stream. + +## Motivation + +Imagine a stream of binary data like `/dev/urandom` that one wishes +for programs to be able to consume in a multicast fashion. An +obvious solution would be to redirect the binary data to a log file, +and then launch a separate `tail` command for each program that needs to +consume output from the log. However, this is not sustainable because +the log size will eventually grow too large if it is unbounded. + +In order to solve this problem with `filebus`, simply pipe the live +stream to a filebus producer as follows: +``` +strings /dev/urandom | filebus --filename /tmp/urandom.filebus producer +``` + +This command causes the file `/tmp/urandom.filebus` to behave like a +multicast pipe for filebus consumers which are launched like this: +``` +filebus --filename /tmp/urandom.filebus consumer +``` + +## Implementation details + +The on-disk file is updated via atomic rename while a lock is held. +File locking makes it safe for multiple producers to concurrently +produce to the same stream. + +The filebus `--back-pressure` protocol uses deleted files to indicate +consumed buffers. File locking ensures that exactly one +consumer will consume and delete each buffer, and producers will +not attempt to write a new buffer until the previous buffer has been +consumed. A producer writes an empty buffer in order to indicate +EOF, and a consumer will terminate when it reads the empty buffer. + +## Caveats + +The `--back-pressure` option implement a lossless protocol, but this +protocol causes only a single consumer to receive a given buffer. +However, it is possible for an unlimited number of consumers which +are not using the `--back-pressure` option to eavesdrop on this stream +(provided they have been granted file read permission at the OS level), +albeit in a lossy manner. + +In the absence of the `--back-pressure` option, consumers will +certainly lose chunks at high data rates, but lower data rates should +be lossless, and consumers should always be able to observe the most +recent chunk if it has not been quickly replaced by another. + +## Alternative implementations + +The bash implementation currently currently reads newline delimited +chunks, whereas the python implementation uses the `--sleep-interval` +and `--block-size` arguments to delimit chunks. The python +implementation is agnostic to the underlying stream in the sense that +it explicitly does not interpret any stream content as a delimiter, +which is a desirable property for filebus, but not essential for many +use cases. + +## Usage +``` +usage: filebus [-h] [--back-pressure] [--block-size N] + [--impl {bash,python}] [--lossless] [--no-file-monitoring] + [--filename FILE] [--sleep-interval N] [-v] + {producer,consumer} ... + + filebus 0.2.0 + A user space multicast named pipe implementation backed by a regular file + +positional arguments: + {producer,consumer} + producer connect producer side of stream + consumer connect consumer side of stream + +optional arguments: + -h, --help show this help message and exit + --back-pressure enable lossless back pressure protocol (unconsumed + chunks cause producers to block) + --block-size N maximum block size in units of bytes + --impl {bash,python}, --implementation {bash,python} + choose an alternative filebus implementation + (alternative implementations interoperate with + eachother) + --lossless an alias for --back-pressure + --no-file-monitoring disable filesystem event monitoring + --filename FILE path of the data file (the producer updates it via + atomic rename) + --sleep-interval N check for new messages at least once every N + seconds + -v, --verbose verbose logging (each occurence increases + verbosity) +``` + + + + +%prep +%autosetup -n filebus-0.3.5 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-filebus -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.5-1 +- Package Spec generated @@ -0,0 +1 @@ +0a4f76d29fd3f02eb022f44dfc423de0 filebus-0.3.5.tar.gz |