Changeset View
Changeset View
Standalone View
Standalone View
swh/fuse/fs/symlink.py
- This file was added.
# Copyright (C) 2020 The Software Heritage developers | |||||
# See the AUTHORS file at the top-level directory of this distribution | |||||
# License: GNU General Public License version 3, or any later version | |||||
# See top-level LICENSE file for more information | |||||
from pathlib import Path | |||||
from typing import Union | |||||
from swh.fuse.fs.entry import EntryMode, FuseEntry | |||||
# Avoid cycling import | |||||
Fuse = "Fuse" | |||||
class SymlinkEntry(FuseEntry): | |||||
""" FUSE virtual entry for symlinks | |||||
Attributes: | |||||
target: path to symlink target | |||||
""" | |||||
def __init__( | |||||
self, name: str, depth: int, fuse: Fuse, target: Union[str, bytes, Path] | |||||
): | |||||
super().__init__(name, int(EntryMode.SYMLINK), depth, fuse) | |||||
self.target = target | |||||
async def length(self) -> int: | |||||
return len(str(self.target)) |