Skip to content

Commit e43d9da

Browse files
committed
update plan
1 parent f710bf5 commit e43d9da

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

add_metadata_plan.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Plán: Přidat volby pro zachování metadata k příkazu save
22

3+
4+
TODO: add --numeric-ids option like in rsync
5+
TODO: when setting owner/group, find the user/group by name, or id when --numeric-ids is specified
6+
7+
38
## Přehled
49

510
Přidat volby `--times` (`-t`), `--perms` (`-p`), `--owner` (`-o`), `--group` (`-g`) k příkazu `save`, které způsobí nastavení příslušných metadata cílového souboru na hodnoty zdrojového souboru.
@@ -56,6 +61,8 @@ with block_output_stream_lock:
5661
block_output_stream.flush()
5762
```
5863

64+
TODO: přidat posílání owner/group také jako řetězce
65+
5966
### 5. Rozšíření do_save - signatura (řádek ~701)
6067

6168
```python
@@ -69,7 +76,7 @@ def do_save(file_path, block_input_stream, truncate=False,
6976
Přidat novou větev pro příkaz `Meta`:
7077

7178
```python
72-
elif command == b'Meta':
79+
elif command == b'meta':
7380
# Read metadata: atime_ns(8) + mtime_ns(8) + mode(4) + uid(4) + gid(4) = 28 bytes
7481
meta_data = block_input_stream.read(28)
7582
if len(meta_data) != 28:
@@ -119,7 +126,7 @@ def test_copy_with_metadata(tmp_path, script_path, use_times, use_perms):
119126

120127
Formát:
121128
```
122-
Meta (4 bytes "Meta")
129+
meta (4 bytes "meta")
123130
atime_ns (8 bytes, signed big-endian)
124131
mtime_ns (8 bytes, signed big-endian)
125132
mode (4 bytes, unsigned big-endian)
@@ -129,7 +136,7 @@ gid (4 bytes, unsigned big-endian)
129136

130137
Celkem: 4 + 28 = 32 bajtů
131138

132-
Pořadí příkazů v protokolu: `data/dlzm...``Meta``Done`
139+
Pořadí příkazů v protokolu: `data/dlzm...``meta``Done`
133140

134141
## Kritické soubory
135142

blockcopy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@ def do_save(file_path, block_input_stream, truncate=False):
730730
received_done = True
731731
f.flush()
732732
done_pos_b = block_input_stream.read(8)
733+
if len(done_pos_b) != 8:
734+
raise IncompleteReadError('Incomplete read of done position from block input stream')
733735
done_pos = int.from_bytes(done_pos_b, 'big')
734736
if truncate:
735737
f.truncate(done_pos)

0 commit comments

Comments
 (0)