MCPcopy
hub / github.com/borgbackup/borg / write

Method write

src/borg/manifest.py:543–565  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

541 return result
542
543 def write(self):
544 from .item import ManifestItem
545
546 # self.timestamp needs to be strictly monotonically increasing. Clocks often are not set correctly
547 if self.timestamp is None:
548 self.timestamp = datetime.now(tz=timezone.utc).isoformat(timespec="microseconds")
549 else:
550 incremented_ts = self.last_timestamp + timedelta(microseconds=1)
551 now_ts = datetime.now(tz=timezone.utc)
552 max_ts = max(incremented_ts, now_ts)
553 self.timestamp = max_ts.isoformat(timespec="microseconds")
554 # include checks for limits as enforced by limited unpacker (used by load())
555 assert self.archives.count() <= MAX_ARCHIVES
556 assert len(self.item_keys) <= 100
557 self.config["item_keys"] = tuple(sorted(self.item_keys))
558 manifest_archives = self.archives.finish(self)
559 manifest = ManifestItem(
560 version=2, archives=manifest_archives, timestamp=self.timestamp, config=StableDict(self.config)
561 )
562 data = self.key.pack_metadata(manifest.as_dict())
563 self.id = self.repo_objs.id_hash(data)
564 robj = self.repo_objs.format(self.MANIFEST_ID, {}, data, ro_type=ROBJ_MANIFEST)
565 self.repository.put_manifest(robj)

Callers 15

do_repo_createMethod · 0.95
saveMethod · 0.45
createMethod · 0.45
saveMethod · 0.45
createMethod · 0.45
debug_logFunction · 0.45
createMethod · 0.45
save_configMethod · 0.45
write_indexMethod · 0.45
get_write_fdMethod · 0.45

Calls 9

StableDictClass · 0.85
isoformatMethod · 0.80
countMethod · 0.80
pack_metadataMethod · 0.80
as_dictMethod · 0.80
finishMethod · 0.45
id_hashMethod · 0.45
formatMethod · 0.45
put_manifestMethod · 0.45

Tested by 1

archiverFunction · 0.36