public static void CallPieceRejected(this RepositoryHooks hooks, FileHash hash, PieceInfo piece) { hooks.OnPieceRejected?.Invoke(new PieceRejected { Hash = hash, Piece = piece }); }
public static void CallBlockWritten(this RepositoryHooks hooks, FileHash hash, BlockIndex block) { hooks.OnBlockWritten?.Invoke(new BlockWritten { Hash = hash, Block = block }); }
public static void CallDataVerified(this RepositoryHooks hooks, FileHash hash, Bitfield bitfield) { hooks.OnDataVerified?.Invoke(new DataVerified { Hash = hash, Bitfield = bitfield }); }
public static void CallDataAllocated(this RepositoryHooks hooks, FileHash hash, string directory) { hooks.OnDataAllocated?.Invoke(new DataAllocated { Hash = hash, Directory = directory }); }
public static void CallBlockRead(this RepositoryHooks hooks, FileHash hash, BlockIndex block, DataBlock payload) { hooks.OnBlockRead?.Invoke(new BlockRead { Hash = hash, Block = block, Payload = payload }); }
public RepositoryContext(RepositoryParameters parameters, RepositoryDependencies dependencies, RepositoryHooks hooks, RepositoryConfiguration configuration) { this.parameters = parameters; this.dependencies = dependencies; this.hooks = hooks; this.configuration = configuration; bitfile = new BitfileService(parameters.Hash, Path.Combine(parameters.MetaDestination, $"{parameters.Hash}.bitfield")); queue = new RepositoryTaskQueue(this); }
public RepositoryService(RepositoryParameters parameters, RepositoryDependencies dependencies, RepositoryHooks hooks, RepositoryConfiguration configuration) { context = new RepositoryContext(parameters, dependencies, hooks, configuration); }
public RepositoryService Build(RepositoryHooks hooks) { return(new RepositoryService(parameters, dependencies, hooks, configuration)); }