Hash and track layer file chunks for torrenting

This commit is contained in:
Jake Moshenko 2015-12-30 17:19:19 -05:00 committed by Jimmy Zelinskie
parent 40c741f34e
commit fe87d3c796
8 changed files with 115 additions and 10 deletions

View file

@ -51,6 +51,8 @@ def store_blob_record_and_temp_link(namespace, repo_name, blob_digest, location_
image = Image.create(storage=storage, docker_image_id=random_image_name, repository=repo)
tag.create_temporary_hidden_tag(repo, image, link_expiration_s)
return storage
def get_blob_upload(namespace, repo_name, upload_uuid):
""" Load the upload which is already in progress.

View file

@ -5,7 +5,7 @@ from peewee import JOIN_LEFT_OUTER, fn, SQL
from data.model import config, db_transaction, InvalidImageException
from data.database import (ImageStorage, Image, DerivedStorageForImage, ImageStoragePlacement,
ImageStorageLocation, ImageStorageTransformation, ImageStorageSignature,
ImageStorageSignatureKind, Repository, Namespace)
ImageStorageSignatureKind, Repository, Namespace, TorrentInfo)
logger = logging.getLogger(__name__)
@ -212,3 +212,7 @@ def get_storage_locations(uuid):
.where(ImageStorage.uuid == uuid))
return [location.location.name for location in query]
def save_torrent_info(storage_object, piece_length, pieces):
TorrentInfo.create(storage=storage_object, piece_length=piece_length, pieces=pieces)