class DiskObjectStore(PackBasedObjectStore):
Constructors: DiskObjectStore.from_config(path, config, file_mode, dir_mode), DiskObjectStore.init(path, file_mode, dir_mode, object_format), DiskObjectStore(path, loose_compression_level, pack_compression_level, pack_index_version, ...)
Git-style object store that exists on disk.
| Class Method | from |
Create a DiskObjectStore from a configuration object. |
| Class Method | init |
Initialize a new disk object store. |
| Method | __init__ |
Open an object store. |
| Method | __repr__ |
Return string representation of DiskObjectStore. |
| Method | add |
Add an alternate path to this object store. |
| Method | add |
Add a single object to this object store. |
| Method | add |
Add a new pack to this object store. |
| Method | add |
Add a new thin pack to this object store. |
| Method | close |
Close the object store and release resources. |
| Method | contains |
Check if a particular object is present by SHA1 and is packed. |
| Method | count |
Count the number of loose objects in the object store. |
| Method | delete |
Delete a loose object from disk. |
| Method | get |
Get the commit graph for this object store. |
| Method | get |
Get the multi-pack-index for this object store. |
| Method | get |
Get the modification time of an object. |
| Method | get |
Obtain the raw fulltext for an object. |
| Method | iter |
Iterate over all object SHAs with the given prefix. |
| Method | prune |
Prune/clean up this object store. |
| Method | write |
Write a commit graph file for this object store. |
| Method | write |
Write a multi-pack-index file for this object store. |
| Instance Variable | dir |
Undocumented |
| Instance Variable | file |
Undocumented |
| Instance Variable | fsync |
Undocumented |
| Instance Variable | loose |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | path |
Undocumented |
| Property | alternates |
Get the list of alternate object stores. |
| Method | _complete |
Move a specific file containing a pack into the pack directory. |
| Method | _get |
Undocumented |
| Method | _get |
Undocumented |
| Method | _get |
Get a pack by its base name. |
| Method | _get |
Undocumented |
| Method | _iter |
Iterate over the SHAs of all loose objects. |
| Method | _read |
Undocumented |
| Method | _remove |
Undocumented |
| Method | _update |
Read and iterate over new pack files and cache them. |
| Instance Variable | _alternates |
Undocumented |
| Instance Variable | _commit |
Undocumented |
| Instance Variable | _midx |
Undocumented |
| Instance Variable | _use |
Undocumented |
| Instance Variable | _use |
Undocumented |
Inherited from PackBasedObjectStore:
| Method | __contains__ |
Check if a particular object is present by SHA1. |
| Method | __del__ |
Warn if the object store is being deleted with unclosed packs. |
| Method | __iter__ |
Iterate over the SHAs that are present in this store. |
| Method | add |
Add a set of objects to this object store. |
| Method | add |
Add pack data to this object store. |
| Method | contains |
Check if a particular object is present by SHA1 and is loose. |
| Method | count |
Count the number of pack files. |
| Method | generate |
Generate bitmap indexes for all packs that don't have them. |
| Method | generate |
Generate pack data objects for a set of wants/haves. |
| Method | get |
Get the best reachability provider for the object store. |
| Method | get |
Obtain the unpacked object. |
| Method | iter |
Iterate over a subset of objects, yielding UnpackedObject instances. |
| Method | iterobjects |
Iterate over a subset of objects in the store. |
| Method | pack |
Pack loose objects. |
| Method | repack |
Repack the packs in this repository. |
| Instance Variable | delta |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | pack |
Undocumented |
| Instance Variable | packed |
Undocumented |
| Property | packs |
List with pack objects. |
| Method | _add |
Add a newly appeared pack to the cache by path. |
| Method | _clear |
Undocumented |
| Method | _enforce |
Evict least-recently-used packs if the memory limit is exceeded. |
| Method | _iter |
Iterate over the SHAs of all the objects in alternate stores. |
| Method | _iter |
Undocumented |
| Method | _mark |
Mark a pack as recently used for LRU tracking. |
| Method | _total |
Return the total mmapped memory across all cached packs. |
| Instance Variable | _pack |
Undocumented |
| Instance Variable | _pack |
Undocumented |
Inherited from BaseObjectStore (via PackBasedObjectStore, PackCapableObjectStore):
| Method | __getitem__ |
Obtain an object by SHA1. |
| Method | determine |
Determine which objects are wanted based on refs. |
| Method | find |
Find which revisions this store has in common using graphwalker. |
| Method | find |
Find the missing objects required for a set of revisions. |
| Method | iter |
Iterate the contents of a tree and all subtrees. |
| Method | peel |
Peel all tags from a SHA. |
| Method | tree |
Find the differences between the contents of two trees. |
| Instance Variable | object |
Undocumented |
| Method | _get |
Return the current available depth for the given head. |
str | os.PathLike[ str], config: Config, *, file_mode: int | None = None, dir_mode: int | None = None) -> DiskObjectStore:
¶
Create a DiskObjectStore from a configuration object.
| Parameters | |
path:str | os.PathLike[ | Path to the object store directory |
config:Config | Configuration object to read settings from |
fileint | None | Optional file permission mask for shared repository |
dirint | None | Optional directory permission mask for shared repository |
| Returns | |
DiskObjectStore | New DiskObjectStore instance configured according to config |
str | os.PathLike[ str], *, file_mode: int | None = None, dir_mode: int | None = None, object_format: ObjectFormat | None = None) -> DiskObjectStore:
¶
Initialize a new disk object store.
Creates the necessary directory structure for a Git object store.
| Parameters | |
path:str | os.PathLike[ | Path where the object store should be created |
fileint | None | Optional file permission mask for shared repository |
dirint | None | Optional directory permission mask for shared repository |
objectObjectFormat | None | Hash algorithm to use (SHA1 or SHA256) |
| Returns | |
DiskObjectStore | New DiskObjectStore instance |
str | os.PathLike[ str], *, loose_compression_level: int = -1, pack_compression_level: int = -1, pack_index_version: int | None = None, pack_delta_window_size: int | None = None, pack_window_memory: int | None = None, pack_delta_cache_size: int | None = None, pack_depth: int | None = None, pack_threads: int | None = None, pack_big_file_threshold: int | None = None, packed_git_limit: int | None = None, delta_base_cache_limit: int | None = None, fsync_object_files: bool = False, pack_write_bitmaps: bool = False, pack_write_bitmap_hash_cache: bool = True, pack_write_bitmap_lookup_table: bool = True, file_mode: int | None = None, dir_mode: int | None = None, object_format: ObjectFormat | None = None):
¶
Open an object store.
| Parameters | |
path:str | os.PathLike[ | Path of the object store. |
looseint | zlib compression level for loose objects |
packint | zlib compression level for pack objects |
packint | None | pack index version to use (1, 2, or 3) |
packint | None | sliding window size for delta compression |
packint | None | memory limit for delta window operations |
packint | None | size of cache for delta operations |
packint | None | maximum delta chain depth |
packint | None | number of threads for pack operations |
packint | None | threshold for treating files as big |
packedint | None | maximum total bytes for mmapped pack files |
deltaint | None | maximum bytes for delta base object cache |
fsyncbool | whether to fsync object files for durability |
packbool | whether to write bitmap indexes for packs |
packbool | whether to include name-hash cache in bitmaps |
packbool | whether to include lookup table in bitmaps |
fileint | None | File permission mask for shared repository |
dirint | None | Directory permission mask for shared repository |
objectObjectFormat | None | Hash algorithm to use (SHA1 or SHA256) |
Return string representation of DiskObjectStore.
| Returns | |
str | String representation including the store path |
Add a new pack to this object store.
- Returns: Fileobject to write to, a commit function to
- call when the pack is finished and an abort function.
Callable[ [ int], bytes], read_some: Callable[ [ int], bytes] | None, progress: Callable[ ..., None] | None = None) -> Pack:
¶
Add a new thin pack to this object store.
Thin packs are packs that contain deltas with parents that exist outside the pack. They should never be placed in the object store directly, and always indexed and completed as they are copied.
- Returns: A Pack object pointing at the now-completed thin pack in the
- objects/pack directory.
| Parameters | |
readCallable[ | Read function that blocks until the number of requested bytes are read. |
readCallable[ | Read function that returns at least one byte, but may not return the number of bytes requested. |
progress:Callable[ | Optional progress reporting function. |
| Returns | |
Pack | Undocumented |
Close the object store and release resources.
This method closes all cached pack files, MIDX, and frees associated resources. Can be called multiple times safely.
Check if a particular object is present by SHA1 and is packed.
This checks the MIDX first if available, then falls back to checking individual pack indexes.
| Parameters | |
sha:ObjectID | RawObjectID | Binary SHA of the object |
| Returns | |
bool | True if the object is in a pack file |
Delete a loose object from disk.
| Parameters | |
sha:ObjectID | SHA1 of the object to delete |
| Raises | |
FileNotFoundError | If the object file doesn't exist |
Get the commit graph for this object store.
| Returns | |
CommitGraph | None | CommitGraph object if available, None otherwise |
Get the multi-pack-index for this object store.
| Returns | |
MultiPackIndex | None | MultiPackIndex object if available, None otherwise |
| Raises | |
ValueError | If MIDX file is corrupt |
OSError | If MIDX file cannot be read |
Prune/clean up this object store.
This removes temporary files that were left behind by interrupted pack operations. These are files that start with tmp_pack_ in the repository directory or files with .pack extension but no corresponding .idx file in the pack directory.
| Parameters | |
graceint | None | Grace period in seconds for removing temporary files. If None, uses DEFAULT_TEMPFILE_GRACE_PERIOD. |
Get the list of alternate object stores.
Reads from .git/objects/info/alternates if not already cached.
| Returns | |
| List of DiskObjectStore instances for alternate object directories |
BinaryIO, path: str, num_objects: int, indexer: PackIndexer, progress: Callable[ ..., None] | None = None, refs: dict[ Ref, ObjectID] | None = None) -> Pack:
¶
Move a specific file containing a pack into the pack directory.
- Note: The file should be on the same file system as the
- packs directory.
| Parameters | |
f:BinaryIO | Open file object for the pack. |
path:str | Path to the pack file. |
numint | Number of objects in the pack. |
indexer:PackIndexer | A PackIndexer for indexing the pack. |
progress:Callable[ | Optional progress reporting function. |
refs:dict[ | Optional dictionary of refs for bitmap generation. |
| Returns | |
Pack | Undocumented |