Skip to content

Commit

Permalink
Remove unneeded multistream dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
talentlessguy committed Jan 22, 2025
1 parent c3f9344 commit 7a0d4d9
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 93 deletions.
32 changes: 0 additions & 32 deletions NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7317,38 +7317,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


---------------------------------------------------------

---------------------------------------------------------

multistream 2.1.1 - MIT
https://github.com/feross/multistream

Copyright (c) Feross Aboukhadijeh
Copyright (c) Feross Aboukhadijeh (http://feross.org).

The MIT License (MIT)

Copyright (c) Feross Aboukhadijeh

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


---------------------------------------------------------

---------------------------------------------------------
Expand Down
58 changes: 14 additions & 44 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"jsonwebtoken": "^9.0.0",
"lokijs": "^1.5.6",
"morgan": "^1.9.1",
"multistream": "^2.1.1",
"mysql2": "^3.10.1",
"rimraf": "^3.0.2",
"sequelize": "^6.31.0",
Expand Down Expand Up @@ -60,7 +59,6 @@
"@types/lokijs": "^1.5.2",
"@types/mocha": "^9.0.0",
"@types/morgan": "^1.7.35",
"@types/multistream": "^2.1.1",
"@types/node": "^14.14.24",
"@types/rimraf": "^3.0.0",
"@types/stoppable": "^1.1.1",
Expand Down
24 changes: 12 additions & 12 deletions src/common/persistence/FSExtentStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
stat,
unlink
} from "fs";
import multistream = require("multistream");
import { join } from "path";
import { Writable } from "stream";
import { PassThrough, Writable, pipeline } from "stream";
import { promisify } from "util";
import uuid = require("uuid");

Expand Down Expand Up @@ -350,10 +349,8 @@ export default class FSExtentStore implements IExtentStore {
const op = () =>
new Promise<NodeJS.ReadableStream>((resolve, reject) => {
this.logger.verbose(
`FSExtentStore:readExtent() Creating read stream. LocationId:${persistencyId} extentId:${
extentChunk.id
} path:${path} offset:${extentChunk.offset} count:${
extentChunk.count
`FSExtentStore:readExtent() Creating read stream. LocationId:${persistencyId} extentId:${extentChunk.id
} path:${path} offset:${extentChunk.offset} count:${extentChunk.count
} end:${extentChunk.offset + extentChunk.count - 1}`,
contextId
);
Expand All @@ -362,10 +359,8 @@ export default class FSExtentStore implements IExtentStore {
end: extentChunk.offset + extentChunk.count - 1
}).on("close", () => {
this.logger.verbose(
`FSExtentStore:readExtent() Read stream closed. LocationId:${persistencyId} extentId:${
extentChunk.id
} path:${path} offset:${extentChunk.offset} count:${
extentChunk.count
`FSExtentStore:readExtent() Read stream closed. LocationId:${persistencyId} extentId:${extentChunk.id
} path:${path} offset:${extentChunk.offset} count:${extentChunk.count
} end:${extentChunk.offset + extentChunk.count - 1}`,
contextId
);
Expand Down Expand Up @@ -449,7 +444,12 @@ export default class FSExtentStore implements IExtentStore {
);
}

return multistream(streams);
const writable = pipeline(streams);
const passthrough = new PassThrough();

passthrough.pipe(writable);

return passthrough;
}

/**
Expand Down Expand Up @@ -561,7 +561,7 @@ export default class FSExtentStore implements IExtentStore {
)}, after ${count} bytes piped. Reject streamPipe().`,
contextId
);

reject(err);
});

Expand Down
10 changes: 7 additions & 3 deletions src/common/persistence/MemoryExtentStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import ZeroBytesStream from "../ZeroBytesStream";
import IExtentMetadataStore, { IExtentModel } from "./IExtentMetadataStore";
import IExtentStore, { IExtentChunk } from "./IExtentStore";
import uuid = require("uuid");
import multistream = require("multistream");
import { Readable } from "stream";
import { PassThrough, Readable, pipeline } from "stream";
import { totalmem } from "os";

export interface IMemoryExtentChunk extends IExtentChunk {
Expand Down Expand Up @@ -367,7 +366,12 @@ export default class MemoryExtentStore implements IExtentStore {
);
}

return multistream(streams);
const writable = pipeline(streams);
const passthrough = new PassThrough();

passthrough.pipe(writable);

return passthrough;
}

async deleteExtents(extents: Iterable<string>): Promise<number> {
Expand Down

0 comments on commit 7a0d4d9

Please sign in to comment.