windows_ug.py 861 B

123456789101112131415161718192021222324252627282930313233
  1. from functools import lru_cache
  2. @lru_cache(maxsize=None)
  3. def _uid2user(uid, default=None):
  4. # On Windows, Borg uses a simplified mapping for ownership fields.
  5. # Return a stable placeholder name.
  6. return "root"
  7. @lru_cache(maxsize=None)
  8. def _user2uid(user, default=None):
  9. if not user:
  10. # user is either None or the empty string
  11. return default
  12. # Use 0 as the canonical uid placeholder on Windows.
  13. return 0
  14. @lru_cache(maxsize=None)
  15. def _gid2group(gid, default=None):
  16. # On Windows, Borg uses a simplified mapping for ownership fields.
  17. # Return a stable placeholder name.
  18. return "root"
  19. @lru_cache(maxsize=None)
  20. def _group2gid(group, default=None):
  21. if not group:
  22. # group is either None or the empty string
  23. return default
  24. # Use 0 as the canonical gid placeholder on Windows.
  25. return 0