summaryrefslogtreecommitdiff
path: root/pypaste/server/s3/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'pypaste/server/s3/__init__.py')
-rw-r--r--pypaste/server/s3/__init__.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/pypaste/server/s3/__init__.py b/pypaste/server/s3/__init__.py
index d2cf7b2..6026fc4 100644
--- a/pypaste/server/s3/__init__.py
+++ b/pypaste/server/s3/__init__.py
@@ -91,6 +91,12 @@ class S3(Storage):
await self.connection.rollback()
raise e
+ async def exists(self, key: str) -> bool:
+ async with self.connection.execute(
+ "select 1 from s3 where key=?", (key,)
+ ) as cursor:
+ return await cursor.fetchone() is not None
+
async def vacuum(self, max: int) -> None:
while True:
async with self.connection.execute(