OpenDAL has removed the native blocking API in the core. The Python binding's blocking API now uses an async runtime internally. This is a transparent change and should not affect most users, but:
The following services have been removed due to lack of maintainers and users:
atomicserver
- This service is no longer supportedicloud
- This service is no longer supportednebula_graph
- This service is no longer supportedIf you were using any of these services, you'll need to migrate to an alternative storage backend.
The Chainsafe service has been sunset and is no longer available.
Because of a TLS lib issue, we temporarily disable the services-ftp
feature.
Operator and BlockingOperator won't accept layers
anymore. Instead, we provide a layer
API:
op = opendal.Operator("memory").layer(opendal.layers.RetryLayer())
We removed not used layers ConcurrentLimitLayer
and ImmutableIndexLayer
along with this change.
OpenDAL removes Reader
and AsyncReader
classes, instead, we provide file-like object File
and AsyncFile
.
Open a file for reading in blocking way:
with op.open(filename, "rb") as r: content = r.read() # With read options with op.open(filename, "rb", offset=1024, size=2048) as r: content = r.read()
Open a file for reading in async way:
async with await op.open(filename, "rb") as r: content = await r.read() # With read options async with await op.open(filename, "rb", offset=1024, size=2048) as r: content = await r.read()
Open a file for writing:
# Blocking write with op.open(filename, "wb") as w: w.write(b"hello world") # With write options with op.open(filename, "wb", content_type="text/plain", if_not_exists=True) as w: w.write(b"hello world") # Async write async with await op.open(filename, "wb") as w: await w.write(b"hello world")
We remove the old error classes and provide a couple of Exception based class for the error handling.
opendal.Error
is based class for all the exceptions now.opendal.exceptions.Unexpected
is added.opendal.exceptions.Unsupported
is added.opendal.exceptions.ConfigInvalid
is added.opendal.exceptions.NotFound
is added.opendal.exceptions.PermissionDenied
is added.opendal.exceptions.IsADirectory
is added.opendal.exceptions.NotADirectory
is added.opendal.exceptions.AlreadyExists
is added.opendal.exceptions.IsSameFile
is added.opendal.exceptions.ConditionNotMatch
is added.opendal.exceptions.ContentTruncated
is added.opendal.exceptions.ContentIncomplete
is added.opendal.exceptions.InvalidInput
is added.