# Key terms and concepts

> Definitions of the concepts you will encounter when using S4 object storage.

All Bitiful S4 buckets are **directory buckets**, roughly equivalent to the [Directory Buckets](https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/userguide/directory-buckets-overview.html) recently introduced by Amazon AWS.

> AWS built its latest high-performance S3 offering on them: [S3 Express One Zone](https://docs.aws.amazon.com/zh_cn/AmazonS3/latest/userguide/s3-express-one-zone.html)

## Bucket

- A bucket is your dedicated space for storing objects. Every object must belong to a bucket. Buckets have various configuration properties, including region and access permissions.
  - Bucket names are globally unique. Once you create a bucket with a given name, no other user can create a bucket with the same name.
  - There is no limit on the storage capacity of a bucket.
- Bucket naming rules:
  - Names can contain only lowercase letters a \~ z, digits 0 \~ 9, and hyphens (-).
  - Names must begin and end with a letter or digit.
  - Names must be between 4 \~ 63 characters long.

## Object

An object is the basic unit of data storage in S4. In this documentation, "object" and "file" mean the same thing. An object consists of three parts: a key, data, and metadata.

- Key: The unique identifier of an object (file) within a bucket, consisting of its full path, including directories and extension. The bucket name plus the key form the [URL](https://baike.baidu.com/item/%E7%BB%9F%E4%B8%80%E8%B5%84%E6%BA%90%E5%AE%9A%E4%BD%8D%E7%B3%BB%E7%BB%9F) used to access and operate on the object over the internet.
- Data: The actual content of the object, for example, the binary data of an image.
- Metadata: Unlike a local file system, object storage uses "metadata" to describe additional properties of an object (file), such as its file type.

Object naming rules:

- Names must be UTF-8 encoded.
- Names must be 1 to 1024 bytes long after UTF-8 encoding.
- Names cannot begin with a backslash (`\`).
- The characters `\a`, `\b`, `\t`, `\n`, `\v`, `\f`, and `\r` are not supported.
- Non-printable ASCII characters 0 \~ 31 and 127 are not supported.
- Names cannot contain a directory level that is entirely `.` or `..`, for example `a/../b.txt`.

Directory objects vs. file objects:

- Directory objects are an S4-specific object type designed to bring native features such as Rename to high-performance scenarios.
- Directory object keys must end with a slash (/).
- Directory objects contain no actual binary data (the body is empty).

<details>
<summary>Example: the object https://somebucket.s3.bitiful.net/userFiles/000001.avatar</summary>

- **The bucket name is**: somebucket.
- **The key is**: userFiles/000001.avatar.
- **The data is**: the actual binary content of the image.
- **The metadata is**: image/jpeg. In object storage, you don't need to rely on the [file extension](https://baike.baidu.com/item/%E6%96%87%E4%BB%B6%E6%89%A9%E5%B1%95%E5%90%8D/1270230) to determine the file type (MIME type). As long as the metadata specifies the type as "image/jpeg", browsers automatically recognize the object as an image when it's accessed.

</details>

## Region

A region is the geographic location of the availability zone that hosts an S4 data center. Currently, only the China East 1 availability zone (cn-east-1) is available.

## Sub-user

A sub-user is the smallest unit of permission management in Bitiful. You can set separate permissions on different `buckets` or directories for each sub-user, and every AccessKey under a sub-user inherits all of that sub-user's permissions. A newly created sub-user has no permissions by default. The console calls it "子用户" (sub-user).

For details, see [Sub-users and AccessKeys](https://docs.bitiful.com/en/bitiful-s4/handbook/access-keys.md) and [Sub-user permissions](https://docs.bitiful.com/en/bitiful-s4/handbook/permissions.md).

## AccessKey

AccessKey (AK) is the collective term for an AccessKey ID and an AccessKey Secret. With an AccessKey, you can easily use Bitiful S4 from any S3-compatible third-party tool or SDK.

## Endpoint

The endpoint is the access address of the S3 protocol. When you configure an SDK or third-party tool, enter `https://s3.bitiful.net`. It differs from a bucket's default domain: the endpoint is used to call APIs, while the default domain is used to access files in a bucket.

## Access domains

| Name                  | Example                             | Description                                                                                                                                                                                     |
| :-------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Bucket default domain | `https://somebucket.s3.bitiful.net` | Available as soon as you create the bucket. Opening a file in a browser forces a download, and single-thread speed is limited                                                                   |
| CDN domain            | `https://img.example.com`           | Your own domain, used for public distribution. See [CDN](https://docs.bitiful.com/en/cdn/intro.md)                                                                                              |
| Bucket domain         | `https://files.example.com`         | A domain bound directly to a bucket. Creating new ones is paused; existing bindings keep working. See [Static websites and domains](https://docs.bitiful.com/en/bitiful-s4/handbook/website.md) |

## Public and private

Private objects can be accessed only with a signature. Public (public read) objects can be read anonymously by anyone, and you can set this for an entire bucket or by directory. See [Public read and private](https://docs.bitiful.com/en/bitiful-s4/handbook/public-read.md). Public access covers reading only, not listing files or writing.

## Presigned URL

A time-limited link generated with an AccessKey for a single operation (for example, downloading a file or uploading to a path). Anyone who holds the link can complete that operation without a key, and the link expires automatically. See [Presigned URLs](https://docs.bitiful.com/en/developer/s3/presigned-url.md).

## Style

Saves a set of image and video processing parameters under a name that you call with `!style:name`. See [Styles](https://docs.bitiful.com/en/coreix/handbook/styles.md).

## Original file protection

Blocks anonymous access to original images and videos and allows access only through styles. See [Original file protection](https://docs.bitiful.com/en/coreix/handbook/origin-protect.md).

## Mirror back-to-origin

When an object doesn't exist in the bucket, S4 automatically fetches it from the origin you specify and saves it. Use it to migrate data. See [Mirror back-to-origin](https://docs.bitiful.com/en/bitiful-s4/handbook/mirror.md).
