Skip to content

Commit

Permalink
feat: inherit from AsyncFsspecStore to specify protocol
Browse files Browse the repository at this point in the history
Specify protocol s3, gs, and abfs
  • Loading branch information
machichima committed Feb 4, 2025
1 parent 29464a7 commit a0d9e1d
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions obstore/python/obstore/fsspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
import fsspec.spec

import obstore as obs
from obstore.store import S3Store, GCSStore, AzureStore, from_url

from obstore.store import from_url

class AsyncFsspecStore(fsspec.asyn.AsyncFileSystem):
"""An fsspec implementation based on a obstore Store.
Expand Down Expand Up @@ -115,7 +114,6 @@ def _split_path(self, path: str) -> Tuple[str, str]:

@lru_cache(maxsize=10)
def _construct_store(self, bucket: str):
# from obstore.store import from_url
return from_url(
url=f"{self.protocol}://{bucket}",
config=self.config,
Expand Down Expand Up @@ -269,3 +267,13 @@ def read(self, length: int = -1):
data = self.fs.cat_file(self.path, self.loc, self.loc + length)
self.loc += length
return data


class S3FsspecStore(AsyncFsspecStore):
protocol = "s3"

class GCSFsspecStore(AsyncFsspecStore):
protocol = "gs"

class AzureFsspecStore(AsyncFsspecStore):
protocol = "abfs"

0 comments on commit a0d9e1d

Please sign in to comment.