diff options
author | Paul Barker <pbarker@konsulko.com> | 2021-02-05 11:26:07 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-10 23:48:16 +0000 |
commit | 3b559bb16df9c178401be49c9cb8130b7d7568fd (patch) | |
tree | fe989962d371476edbb7702ec83234b8b9d8bfe3 /bitbake/lib/hashserv/__init__.py | |
parent | f5188da2f12bee03e087c20d90720250e65e2922 (diff) | |
download | poky-3b559bb16df9c178401be49c9cb8130b7d7568fd.tar.gz |
bitbake: hashserv: Support read-only server
The -r/--readonly argument is added to the bitbake-hashserv app. If this
argument is given then clients may only perform read operations against
the server. The read-only mode is implemented by simply not installing
handlers for write operations, this keeps the permission model simple
and reduces the risk of accidentally allowing write operations.
As a sqlite database can be safely opened by multiple processes in
parallel, it's possible to start two hashserv instances against a single
database if you wish to export both a read-only port and a read-write
port.
(Bitbake rev: 492bb02eb0e071c792407ac3113f92492da1a9cc)
Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/hashserv/__init__.py')
-rw-r--r-- | bitbake/lib/hashserv/__init__.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bitbake/lib/hashserv/__init__.py b/bitbake/lib/hashserv/__init__.py index 55f48410d3..5f2e101e52 100644 --- a/bitbake/lib/hashserv/__init__.py +++ b/bitbake/lib/hashserv/__init__.py | |||
@@ -94,10 +94,10 @@ def chunkify(msg, max_chunk): | |||
94 | yield "\n" | 94 | yield "\n" |
95 | 95 | ||
96 | 96 | ||
97 | def create_server(addr, dbname, *, sync=True, upstream=None): | 97 | def create_server(addr, dbname, *, sync=True, upstream=None, read_only=False): |
98 | from . import server | 98 | from . import server |
99 | db = setup_database(dbname, sync=sync) | 99 | db = setup_database(dbname, sync=sync) |
100 | s = server.Server(db, upstream=upstream) | 100 | s = server.Server(db, upstream=upstream, read_only=read_only) |
101 | 101 | ||
102 | (typ, a) = parse_address(addr) | 102 | (typ, a) = parse_address(addr) |
103 | if typ == ADDR_TYPE_UNIX: | 103 | if typ == ADDR_TYPE_UNIX: |