class SCHEMA_CLS(BaseSchema): type = fields.EnumCheckedConstant( LocalManifestType.LOCAL_WORKSPACE_MANIFEST, required=True) base = fields.Nested(RemoteWorkspaceManifest.SCHEMA_CLS, required=True) need_sync = fields.Boolean(required=True) updated = fields.DateTime(required=True) children = fields.FrozenMap(EntryNameField(), EntryIDField(required=True), required=True) # Confined entries are entries that are meant to stay locally and not be added # to the uploaded remote manifest when synchronizing. The criteria for being # confined is to have a filename that matched the "prevent sync" pattern at the time of # the last change (or when a new filter was successfully applied) local_confinement_points = fields.FrozenSet( EntryIDField(required=True)) # Filtered entries are entries present in the base manifest that are not exposed # locally. We keep track of them to remember that those entries have not been # deleted locally and hence should be restored when crafting the remote manifest # to upload. remote_confinement_points = fields.FrozenSet( EntryIDField(required=True)) @post_load def make_obj(self, data): data.pop("type") data.setdefault("local_confinement_points", frozenset()) data.setdefault("remote_confinement_points", frozenset()) return LocalWorkspaceManifest(**data)
class SCHEMA_CLS(BaseSchema): type = fields.EnumCheckedConstant( LocalManifestType.LOCAL_WORKSPACE_MANIFEST, required=True) base = fields.Nested(_PyWorkspaceManifest.SCHEMA_CLS, required=True) need_sync = fields.Boolean(required=True) updated = fields.DateTime(required=True) children = fields.FrozenMap(EntryNameField(), EntryIDField(), required=True) # Added in Parsec v1.15 # Confined entries are entries that are meant to stay locally and not be added # to the uploaded remote manifest when synchronizing. The criteria for being # confined is to have a filename that matched the "prevent sync" pattern at the time of # the last change (or when a new filter was successfully applied) local_confinement_points = fields.FrozenSet(EntryIDField(), allow_none=False, required=False, missing=frozenset()) # Added in Parsec v1.15 # Filtered entries are entries present in the base manifest that are not exposed # locally. We keep track of them to remember that those entries have not been # deleted locally and hence should be restored when crafting the remote manifest # to upload. remote_confinement_points = fields.FrozenSet(EntryIDField(), allow_none=False, required=False, missing=frozenset()) # Added in Parsec v1.15 # Speculative placeholders are created when we want to access a workspace # but didn't retrieve manifest data from backend yet. This implies: # - non-placeholders cannot be speculative # - the only non-speculative placeholder is the placeholder initialized # during the initial workspace creation # This speculative information is useful during merge to understand if # a data is not present in the placeholder compared with a remote because: # a) the data is not locally known (speculative is True) # b) the data is known, but has been locally removed (speculative is False) # Prevented to be `required=True` by backward compatibility speculative = fields.Boolean(allow_none=False, required=False, missing=False) @post_load def make_obj(self, data): # TODO: Ensure non-placeholder cannot be marked speculative assert data["speculative"] is False or data["base"].version == 0 # TODO: Should this assert be in remote workspace manifest definition instead ? # TODO: but in theory remote workspace manifest should assert version > 0 ! assert data["base"].version != 0 or not data["base"].children data.pop("type") return LocalWorkspaceManifest(**data)