This topic describes how ossfs 2.0 detects files and folders in an Object Storage Service (OSS) bucket.
Core differences between object storage and traditional storage
Object storage uses a flat address space to store data, unlike the hierarchical folder structure of traditional file systems. The core differences are as follows:
No hierarchical association: OSS buckets do not have the concept of files and folders. All data is stored as objects.
Differences in naming conventions:
Traditional file system: A file named 'a' and a folder named 'a/' cannot exist in the same folder.
Object storage: 'a' and 'a/' are two independent objects. They can coexist and have no logical association.
ossfs 2.0 file system simulation mechanism
When you mount an OSS bucket using ossfs 2.0, ossfs simulates a file system as follows.
Folder tree construction: It uses the forward slash (
/) as a path separator to build a virtual folder structure based on object names.Detection logic: It infers the object type (file or folder) by analyzing the
/separator in the object name and the relationships between sub-objects.
Object detection principles
If you use tools such as ossfs 1.0 and ossfs 2.0 or products such as Cloud Storage Gateway (CSG) to mount an OSS bucket, follow file system naming conventions when you create objects in the bucket. Do not create objects with names that differ only by a trailing forward slash, such as a and a/.
Scenario | Detection result | Condition or logic |
The bucket contains only the object | File | A single object without a trailing |
The bucket contains only the object | Folder | An object name that ends with |
The bucket contains the object | Folder | The parent |
The bucket contains both the object | Undefined behavior | The object naming in the bucket does not follow file system conventions. |
The bucket contains the objects | Undefined behavior | The object naming in the bucket does not follow file system conventions. |