Exemplo n.º 1
0
 public static void CallPieceRejected(this RepositoryHooks hooks, FileHash hash, PieceInfo piece)
 {
     hooks.OnPieceRejected?.Invoke(new PieceRejected
     {
         Hash  = hash,
         Piece = piece
     });
 }
Exemplo n.º 2
0
 public static void CallBlockWritten(this RepositoryHooks hooks, FileHash hash, BlockIndex block)
 {
     hooks.OnBlockWritten?.Invoke(new BlockWritten
     {
         Hash  = hash,
         Block = block
     });
 }
Exemplo n.º 3
0
 public static void CallDataVerified(this RepositoryHooks hooks, FileHash hash, Bitfield bitfield)
 {
     hooks.OnDataVerified?.Invoke(new DataVerified
     {
         Hash     = hash,
         Bitfield = bitfield
     });
 }
Exemplo n.º 4
0
 public static void CallDataAllocated(this RepositoryHooks hooks, FileHash hash, string directory)
 {
     hooks.OnDataAllocated?.Invoke(new DataAllocated
     {
         Hash      = hash,
         Directory = directory
     });
 }
Exemplo n.º 5
0
 public static void CallBlockRead(this RepositoryHooks hooks, FileHash hash, BlockIndex block, DataBlock payload)
 {
     hooks.OnBlockRead?.Invoke(new BlockRead
     {
         Hash    = hash,
         Block   = block,
         Payload = payload
     });
 }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
 public RepositoryService(RepositoryParameters parameters, RepositoryDependencies dependencies, RepositoryHooks hooks, RepositoryConfiguration configuration)
 {
     context = new RepositoryContext(parameters, dependencies, hooks, configuration);
 }
Exemplo n.º 8
0
 public RepositoryService Build(RepositoryHooks hooks)
 {
     return(new RepositoryService(parameters, dependencies, hooks, configuration));
 }