make the project build

This commit is contained in:
Michael Zhang 2020-04-21 19:33:15 -05:00
parent 84d6ffe709
commit 7c9ed689ba
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
9 changed files with 55 additions and 95 deletions

86
Cargo.lock generated
View file

@ -1,11 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "adler32"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d2e7343e7fc9de883d1b0341e0b13970f764c14101234857d2ddafa1cb1cac2"
[[package]]
name = "aho-corasick"
version = "0.7.10"
@ -48,8 +42,7 @@ version = "0.1.0"
dependencies = [
"anyhow",
"async-zlib",
"flate2",
"futures 0.3.4",
"futures",
"sha-1",
"structopt",
"thiserror",
@ -124,16 +117,6 @@ version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
[[package]]
name = "bytes"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
dependencies = [
"byteorder",
"iovec",
]
[[package]]
name = "bytes"
version = "0.5.4"
@ -204,15 +187,6 @@ dependencies = [
"unicode_categories",
]
[[package]]
name = "crc32fast"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-channel"
version = "0.4.2"
@ -274,7 +248,7 @@ dependencies = [
"anyhow",
"async-git",
"comrak",
"futures 0.3.4",
"futures",
"git2",
"hyper",
"lazy_static",
@ -296,20 +270,6 @@ dependencies = [
name = "fedhub-hooks"
version = "0.1.0"
[[package]]
name = "flate2"
version = "1.0.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cfff41391129e0a856d6d822600b8d71179d46879e310417eb9c762eb178b42"
dependencies = [
"cfg-if",
"crc32fast",
"futures 0.1.29",
"libc",
"miniz_oxide",
"tokio-io",
]
[[package]]
name = "fnv"
version = "1.0.6"
@ -332,12 +292,6 @@ version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]]
name = "futures"
version = "0.1.29"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef"
[[package]]
name = "futures"
version = "0.3.4"
@ -479,7 +433,7 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "377038bf3c89d18d6ca1431e7a5027194fbd724ca10592b9487ede5e8e144f42"
dependencies = [
"bytes 0.5.4",
"bytes",
"fnv",
"futures-core",
"futures-sink",
@ -516,7 +470,7 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9"
dependencies = [
"bytes 0.5.4",
"bytes",
"fnv",
"itoa",
]
@ -527,7 +481,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
dependencies = [
"bytes 0.5.4",
"bytes",
"http",
]
@ -543,7 +497,7 @@ version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96816e1d921eca64d208a85aab4f7798455a8e34229ee5a88c935bdee1b78b14"
dependencies = [
"bytes 0.5.4",
"bytes",
"futures-channel",
"futures-core",
"futures-util",
@ -725,15 +679,6 @@ version = "2.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]]
name = "miniz_oxide"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa679ff6578b1cddee93d7e82e263b94a575e0bfced07284eb0c037c1d2416a5"
dependencies = [
"adler32",
]
[[package]]
name = "mio"
version = "0.6.21"
@ -1103,7 +1048,7 @@ version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3eeb1fe3fc011cde97315f370bc88e4db3c23b08709a04915921e02b1d363b20"
dependencies = [
"bytes 0.5.4",
"bytes",
"combine",
"dtoa",
"futures-executor",
@ -1402,7 +1347,7 @@ version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34ef16d072d2b6dc8b4a56c70f5c5ced1a37752116f8e7c1e80c659aa7cb6713"
dependencies = [
"bytes 0.5.4",
"bytes",
"fnv",
"futures-core",
"iovec",
@ -1420,17 +1365,6 @@ dependencies = [
"winapi 0.3.8",
]
[[package]]
name = "tokio-io"
version = "0.1.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674"
dependencies = [
"bytes 0.4.12",
"futures 0.1.29",
"log",
]
[[package]]
name = "tokio-macros"
version = "0.2.5"
@ -1448,7 +1382,7 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "571da51182ec208780505a32528fc5512a8fe1443ab960b3f2f3ef093cd16930"
dependencies = [
"bytes 0.5.4",
"bytes",
"futures-core",
"futures-sink",
"log",
@ -1462,7 +1396,7 @@ version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
dependencies = [
"bytes 0.5.4",
"bytes",
"futures-core",
"futures-sink",
"log",

View file

@ -16,5 +16,4 @@ anyhow = { version = "1.0.28", default-features = false }
thiserror = { version = "1.0.15", default-features = false }
futures = { version = "0.3.4", default-features = false }
sha-1 = { version = "0.8.2", default-features = false }
flate2 = { version = "1.0.14", features = ["tokio"] }
async-zlib = { path = "../async-zlib" }

View file

@ -1,9 +1,9 @@
use std::io::Error as IOError;
use tokio::io::{AsyncWrite, AsyncRead};
use tokio::io::{AsyncRead, AsyncWrite};
use crate::util::ZlibIO;
use crate::plumbing::Oid;
use crate::util::ZlibIO;
#[derive(Clone)]
pub struct Commit {

View file

@ -1,16 +1,15 @@
use std::fs::File;
use std::path::PathBuf;
use std::pin::Pin;
use std::str::FromStr;
use std::task::{Context, Poll};
use anyhow::Error;
use flate2::read::ZlibDecoder;
use tokio::io::{AsyncReadExt};
use async_zlib::ZlibDecoder;
use tokio::{io::AsyncReadExt, fs::File};
use typenum::U19;
use crate::plumbing::Commit;
use crate::util::{ZlibIO, self};
use crate::util::{self, ZlibIO};
pub struct Object {
repo_path: PathBuf,
@ -25,15 +24,17 @@ impl Object {
}
pub async fn peel(&self) -> Result<ParsedObject, Error> {
let file = File::open(self.get_path_on_disk())?;
let r = ZlibDecoder::new(file);
let file = File::open(self.get_path_on_disk()).await?;
let mut r = ZlibDecoder::new(file);
// we're going to determine the type of object based on the first character
let c = r.read_u8().await?;
unimplemented!()
}
}
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct Oid([u8; 20]);
impl FromStr for Oid {

View file

@ -1,8 +1,12 @@
use anyhow::Result;
use crate::plumbing::Oid;
#[derive(StructOpt)]
#[derive(Debug, StructOpt)]
pub struct LogOptions {
commit: Oid,
}
pub async fn log_cmd(options: LogOptions) {}
pub async fn log_cmd(options: LogOptions) -> Result<()> {
Ok(())
}

View file

@ -1,7 +1,7 @@
mod init;
mod show;
mod log;
mod show;
pub use self::init::{init_cmd, InitOptions};
pub use self::show::{show_cmd, ShowOptions};
pub use self::log::{log_cmd, LogOptions};
pub use self::show::{show_cmd, ShowOptions};

View file

@ -1,6 +1,6 @@
use crate::plumbing::Oid;
#[derive(StructOpt)]
#[derive(Debug, StructOpt)]
pub struct ShowOptions {
/// The names of objects to show (defaults to HEAD).
objects: Vec<Oid>,
@ -9,7 +9,5 @@ pub struct ShowOptions {
pub async fn show_cmd(options: ShowOptions) {
let mut objects = options.objects;
for id in objects {
}
for id in objects {}
}

View file

@ -1,8 +1,8 @@
use std::io;
use std::path::Path;
use async_zlib::{ZlibDecoder, ZlibEncoder};
use tokio::{fs::File, io::AsyncWriteExt};
use flate2::read::ZlibDecoder;
use typenum::Unsigned;
/// Marker trait to ensure compression/decompression is already happening transparently.
@ -10,6 +10,8 @@ pub trait ZlibIO {}
impl<R> ZlibIO for ZlibDecoder<R> {}
impl<W> ZlibIO for ZlibEncoder<W> {}
#[inline]
fn hexchar(b: u8) -> [u8; 2] {
let a = b >> 4;

View file

@ -1 +1,23 @@
use std::io::Error as IOError;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::AsyncRead;
pub struct ZlibDecoder<R>(R);
impl<R: AsyncRead + Unpin> ZlibDecoder<R> {
pub fn new(r: R) -> Self {
ZlibDecoder(r)
}
}
impl<R: AsyncRead + Unpin> AsyncRead for ZlibDecoder<R> {
fn poll_read(
self: Pin<&mut Self>,
ctx: &mut Context<'_>,
buf: &mut [u8],
) -> Poll<Result<usize, IOError>> {
todo!()
}
}