
There's a bunch of moving pieces here: - Add a new RingWriter class. Stick it in a new swift.common.ring.io module. You *can* use it like the old gzip file, but you can also define named sections which can be referenced later on read. Section names may be arbitrary strings, but the "swift/" prefix is reserved for upstream use. Sections must contain a single length-value encoded BLOB. If sections are used, an additional BLOB is written at the end containing a JSON section-index, followed by an uncompressed offset for the index. Move RingReader to ring/io.py, too. - Clean up some ring metadata handling: - Drop MD5 tracking in RingReader. It was brittle at best anyway, and nothing uses it. YAGNI - Fix size/raw_size attributes when loading only metadata. - Add the ability to seek within RingReaders, though you need to know what you're doing and only seek to flush points. - Let RingBuilder objects change how wide their replica2part2dev_id arrays are. Add a dev_id_bytes key to serialized ring metadata. dev_id_bytes may be either 2 or 4, but 4 requires v2 rings. We considered allowing dev_id_bytes of 1, but dropped it as unnecessary complexity for a niche use case. - swift-ring-builder version subcommand added, which takes a ring. This lets operators see the serialization format of a ring on disk: $ swift-ring-builder object.ring.gz version object.ring.gz: Serialization version: 2 (2-byte IDs), build version: 54 Signed-off-by: Tim Burke <tim.burke@gmail.com> Change-Id: Ia0ac4ea2006d8965d7fdb6659d355c77386adb70
21 lines
725 B
Plaintext
21 lines
725 B
Plaintext
#-------------------------------------------------------------------------------
|
|
# Openstack swift
|
|
# Note: add this snippet to either /etc/magic or ~/.magic
|
|
#-------------------------------------------------------------------------------
|
|
# gzip compressed
|
|
0 beshort 0x1f8b
|
|
# compress method: deflate, flags: FNAME
|
|
>&0 beshort 0x0808
|
|
# skip ahead another 6 (MTIME, XLF, OS); read FNAME
|
|
>>&6 search/0x40 \0
|
|
# Skip ahead five; should cover
|
|
# 00 -- uncompressed block
|
|
# 06 00 -- ... of length 6
|
|
# f9 ff -- (one's complement of length)
|
|
>>>&5 string/4 R1NG Swift ring,
|
|
>>>>&0 clear x
|
|
>>>>&0 beshort 1 version 1
|
|
>>>>&0 beshort 2 version 2
|
|
>>>>&0 default x
|
|
>>>>>&0 beshort x unknown version (0x%04x)
|