8000 Remove unused `update_archive` by Swatinem · Pull Request #683 · codecov/worker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Remove unused update_archive #683

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 2 additions & 41 deletions services/archive.py
41D1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import sentry_sdk
from shared.config import get_config
from shared.storage.base import BaseStorageService
from shared.utils.ReportEncoder import ReportEncoder

from helpers.metrics import metrics
Expand Down Expand Up @@ -39,27 +38,16 @@ def get_path(self, **kwaargs) -> str:
# Service class for performing archive operations. Meant to work against the
# underlying StorageService
class ArchiveService(object):
root = None
"""
The root level of the archive. In s3 terms,
this would be the name of the bucket
"""

root = None

"""
Region where the storage is located.
"""
region = None

"""
A hash key of the repo for internal storage
"""
storage_hash = None

"""
Boolean. True if enterprise, False if not.
A hash key of the repo for internal storage
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this comment in the wrong place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess its the weird way that python doc comments work, as they appear (inside, or) after the item they are documenting

"""
enterprise = False

def __init__(self, repository, bucket=None) -> None:
if bucket is None:
Expand All @@ -73,13 +61,6 @@ def __init__(self, repository, bucket=None) -> None:
def get_now(self) -> datetime:
return datetime.now()

def storage_client(self) -> BaseStorageService:
"""
Accessor for underlying StorageService. You typically shouldn't need
this for anything.
"""
return self.storage

@classmethod
def get_archive_hash(cls, repository) -> str:
"""
Expand All @@ -102,13 +83,6 @@ def get_archive_hash(cls, repository) -> str:
_hash.update(val)
return b16encode(_hash.digest()).decode()

def update_archive(self, path, data) -> None:
"""
Grabs path from storage, adds data to path object
writes back to path, overwriting the original contents
"""
self.storage.append_to_file(self.root, path, data)

@sentry_sdk.trace
def write_file(
self, path, data, reduced_redundancy=False, *, is_already_gzipped=False
Expand Down Expand Up @@ -300,16 +274,3 @@ def read_chunks(self, commit_sha, report_code=None) -> str:
)

return self.read_file(path).decode(errors="replace")

def delete_chunk_from_archive(self, commit_sha, report_code=None) -> None:
"""
Delete a chunk file from the archive
"""
chunks_file_name = report_code if report_code is not None else "chunks"
path = MinioEndpoints.chunks.get_path(
version="v4",
repo_hash=self.storage_hash,
commitid=commit_sha,
chunks_file_name=chunks_file_name,
)
self.delete_file(path)
Loading
0