Summary

Add support for accessor capabilities so that users can check if a given accessor is capable of a given ability.

Motivation

Users of OpenDAL are requesting advanced features like the following:

It's meaningful for OpenDAL to support them in a unified way. Of course, not all storage services have the same feature sets. OpenDAL needs to provide a way for users to check if a given accessor is capable of a given capability.

Guide-level explanation

Users can check an Accessor's capability via Operator::metadata().

let meta = op.metadata();
let _: bool = meta.can_presign();
let _: bool = meta.can_multipart(); 

Accessor will return io::ErrorKind::Unsupported for not supported operations instead of panic as unimplemented().

Users can check before operations or the Unsupported error kind after operations.

Reference-level explanation

We will introduce a new enum called AccessorCapability, which includes AccessorMetadata.

This enum is private and only accessible inside OpenDAL, so it's not part of our public API. We will expose the check API via AccessorMetadata:

impl AccessorMetadata {
    pub fn can_presign(&self) -> bool { .. }
    pub fn can_multipart(&self) -> bool { .. }
}

Drawbacks

None.

Rationale and alternatives

None.

Prior art

go-storage

Unresolved questions

None.

Future possibilities

None.