mirror of https://github.com/borgbackup/borg.git
move zeros to constants module
This commit is contained in:
parent
3b9798cffc
commit
be257728ca
|
@ -19,7 +19,7 @@ from .logger import create_logger
|
|||
logger = create_logger()
|
||||
|
||||
from . import xattr
|
||||
from .chunker import get_chunker, Chunk, cached_hash, zeros
|
||||
from .chunker import get_chunker, Chunk, cached_hash
|
||||
from .cache import ChunkListEntry
|
||||
from .crypto.key import key_factory
|
||||
from .compress import Compressor, CompressionSpec
|
||||
|
|
|
@ -6,7 +6,7 @@ import errno
|
|||
import os
|
||||
from collections import namedtuple
|
||||
|
||||
from .constants import CH_DATA, CH_ALLOC, CH_HOLE, MAX_DATA_SIZE
|
||||
from .constants import CH_DATA, CH_ALLOC, CH_HOLE, MAX_DATA_SIZE, zeros
|
||||
from .lrucache import LRUCache
|
||||
|
||||
from libc.stdlib cimport free
|
||||
|
@ -53,8 +53,6 @@ def Chunk(data, **meta):
|
|||
return _Chunk(meta, data)
|
||||
|
||||
|
||||
zeros = bytes(MAX_DATA_SIZE)
|
||||
|
||||
# remember a few recently used all-zero chunk hashes in this mapping.
|
||||
# (hash_func, chunk_length) -> chunk_hash
|
||||
# we play safe and have the hash_func in the mapping key, in case we
|
||||
|
|
|
@ -45,6 +45,10 @@ assert MAX_OBJECT_SIZE == 20 * 1024 * 1024
|
|||
# repo config max_segment_size value must be below this limit to stay within uint32 offsets:
|
||||
MAX_SEGMENT_SIZE_LIMIT = 2 ** 32 - MAX_OBJECT_SIZE
|
||||
|
||||
# have one all-zero bytes object
|
||||
# we use it at all places where we need to detect or create all-zero buffers
|
||||
zeros = bytes(MAX_DATA_SIZE)
|
||||
|
||||
# borg.remote read() buffer size
|
||||
BUFSIZE = 10 * 1024 * 1024
|
||||
|
||||
|
|
Loading…
Reference in New Issue