objectstore: keep strong reference of objects

The objectstore always tracked all objects that were returned from
it, but it did so via weak references, which means it did not keep
the objects alive itself. With the introduction of identifiers for
temporary objects (floating objects), it makes sense to keep all
created objects alive so that they can in fact be used.
This commit is contained in:
Christian Kellner 2020-12-17 16:56:12 +01:00 committed by Tom Gundersen
parent e5b12e55f4
commit 76e72b1c3f

View file

@ -4,7 +4,6 @@ import hashlib
import os
import subprocess
import tempfile
import weakref
from typing import Optional
from osbuild.util.types import PathLike
@ -249,7 +248,7 @@ class ObjectStore(contextlib.AbstractContextManager):
os.makedirs(self.objects, exist_ok=True)
os.makedirs(self.refs, exist_ok=True)
os.makedirs(self.tmp, exist_ok=True)
self._objs = weakref.WeakSet()
self._objs = set()
def _get_floating(self, object_id: str) -> Optional[Object]:
"""Internal: get a non-committed object"""