Skip to content

Commit

Permalink
transfer: less information (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
skyzh authored Mar 4, 2021
1 parent 5bae53f commit 66f3572
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ https://github.com/sjtug/mirror-clone/issues/14
mirror-clone revolves around abstractions like source, target, snapshot, and transfer.
By assembling them, we can get a task that transfers one repo to another.

## Quick Start

RUST_LOG=info cargo run --release -- --progress --target-type s3 --s3-prefix homebrew-bottles --s3-buffer-path /tmp homebrew
RUST_LOG=info cargo run --release -- --progress --target-type s3 --s3-prefix crates.io/crates --s3-buffer-path /tmp crates-io

## Implementation

### Transfer
Expand All @@ -21,16 +26,15 @@ By assembling them, we can get a task that transfers one repo to another.

### Snapshot

* rsync snapshot, gets file list of a rsync repo.
* PyPI snapshot, gets all packages from PyPI simple index.
* rustup snapshot, gets all toolchains from `channel-xxx-xxxx.toml`
Refer to source code for more information.

### Source

Currently all snapshots are also source. We'll add standalone source later.
Refer to source code for more information.
### Target

* mirror-intel, sends HEAD request to [mirror-intel](https://github.com/sjtug/mirror-intel) endpoint, so as to fill the mirror-intel cache.
* S3

## Commands

Expand Down
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![feature(str_split_once)]

mod common;
mod crates_io;
mod dart;
Expand Down
11 changes: 9 additions & 2 deletions src/simple_diff_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,22 @@ where
let mut updates = vec![];
let mut deletions = vec![];

let mut max_info = 0;
for result in classify(source_snapshot, target_snapshot) {
match result {
Inclusion::Left(source) => {
println!("+ {:?}", source.0);
if max_info < 100 {
info!(logger, "+ {:?}", source.0);
max_info += 1;
}
updates.push(source);
}
Inclusion::Both(_, _) => {}
Inclusion::Right(target) => {
println!("- {:?}", target.0);
if max_info < 100 {
info!(logger, "- {:?}", target.0);
max_info += 1;
}
deletions.push(target);
}
}
Expand Down

0 comments on commit 66f3572

Please sign in to comment.