diff options
author | Lars Wirzenius <liw@liw.fi> | 2022-10-26 17:33:52 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2022-10-28 08:57:41 +0300 |
commit | 14ab788c930846aeb2c472b421a9030b0e9e95f3 (patch) | |
tree | 27f5da006713f2f48a0f6836f6485133c9434278 /subplot/server.py | |
parent | 892df3d488f2df04566f9c19285971f2954d3361 (diff) | |
download | obnam2-14ab788c930846aeb2c472b421a9030b0e9e95f3.tar.gz |
feat! finish chunk store abstraction
This builds on Alexander's work to show me how to get past the problem
I had. There's additional changes to finish off the changes.
Drop chunk deletion from server: it's not a good idea to have it until
the server API is authenticated.
Sponsored-by: author
Diffstat (limited to 'subplot/server.py')
-rw-r--r-- | subplot/server.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/subplot/server.py b/subplot/server.py index 1f4506f..a604733 100644 --- a/subplot/server.py +++ b/subplot/server.py @@ -87,7 +87,9 @@ def delete_chunk_by_id(ctx, chunk_id=None): def make_chunk_file_be_empty(ctx, chunk_id=None): chunk_id = ctx["vars"][chunk_id] chunks = ctx["config"]["chunks"] - for (dirname, _, _) in os.walk(chunks): + logging.debug(f"trying to empty chunk {chunk_id}") + for (dirname, _, filenames) in os.walk(chunks): + logging.debug(f"found directory {dirname}, with {filenames}") filename = os.path.join(dirname, chunk_id + ".data") if os.path.exists(filename): logging.debug(f"emptying chunk file {filename}") @@ -136,7 +138,7 @@ def server_has_n_chunks(ctx, n=None): assert_eq = globals()["assert_eq"] n = int(n) files = find_files(ctx["config"]["chunks"]) - files = [json.load(open(x)) for x in files if x.endswith(".meta")] + files = [x for x in files if x.endswith(".data")] logging.debug(f"server_has_n_file_chunks: n={n}") logging.debug(f"server_has_n_file_chunks: len(files)={len(files)}") logging.debug(f"server_has_n_file_chunks: files={files}") |