mirror of
https://github.com/Drop-OSS/droplet.git
synced 2025-11-10 20:42:14 +10:00
fix: chunk size
This commit is contained in:
@ -2,7 +2,7 @@ import test from "ava";
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|
||||||
import { generateManifest } from "../index.js";
|
import { generateManifest, listFiles } from "../index.js";
|
||||||
|
|
||||||
test("numerous small file", async (t) => {
|
test("numerous small file", async (t) => {
|
||||||
// Setup test dir
|
// Setup test dir
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@drop-oss/droplet",
|
"name": "@drop-oss/droplet",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"types": "index.d.ts",
|
"types": "index.d.ts",
|
||||||
"napi": {
|
"napi": {
|
||||||
|
|||||||
@ -6,6 +6,9 @@ use std::{
|
|||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CHUNK_SIZE: usize = 1024 * 1024 * 64;
|
||||||
|
|
||||||
|
|
||||||
fn _list_files(vec: &mut Vec<PathBuf>, path: &Path) {
|
fn _list_files(vec: &mut Vec<PathBuf>, path: &Path) {
|
||||||
if metadata(path).unwrap().is_dir() {
|
if metadata(path).unwrap().is_dir() {
|
||||||
let paths = fs::read_dir(path).unwrap();
|
let paths = fs::read_dir(path).unwrap();
|
||||||
@ -69,7 +72,7 @@ impl VersionBackend for PathVersionBackend {
|
|||||||
|
|
||||||
fn reader(&self, file: &VersionFile) -> BufReader<File> {
|
fn reader(&self, file: &VersionFile) -> BufReader<File> {
|
||||||
let file = File::open(self.base_dir.join(file.relative_filename.clone())).unwrap();
|
let file = File::open(self.base_dir.join(file.relative_filename.clone())).unwrap();
|
||||||
let reader = BufReader::with_capacity(4096, file);
|
let reader = BufReader::with_capacity(CHUNK_SIZE, file);
|
||||||
return reader;
|
return reader;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,8 +18,6 @@ use uuid::Uuid;
|
|||||||
|
|
||||||
use crate::file_utils::create_backend_for_path;
|
use crate::file_utils::create_backend_for_path;
|
||||||
|
|
||||||
const CHUNK_SIZE: usize = 1024 * 1024 * 64;
|
|
||||||
|
|
||||||
#[derive(serde::Serialize)]
|
#[derive(serde::Serialize)]
|
||||||
struct ChunkData {
|
struct ChunkData {
|
||||||
permissions: u32,
|
permissions: u32,
|
||||||
|
|||||||
Reference in New Issue
Block a user