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

@ -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)