Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests and separate from class validation merge methods #363

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import decompressLZ4 from "@lichtblick/wasm-lz4";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";
Expand All @@ -46,7 +46,7 @@ export class BagIterableSource implements IIterableSource {
this.#source = source;
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
await decompressLZ4.isLoaded;
const bzip2 = await Bzip2.init();

Expand Down Expand Up @@ -111,7 +111,7 @@ export class BagIterableSource implements IIterableSource {
const datatypes: RosDatatypes = new Map();
const topics = new Map<string, Topic>();
const topicStats = new Map<string, TopicStats>();
const publishersByTopic: Initalization["publishersByTopic"] = new Map();
const publishersByTopic: Initialization["publishersByTopic"] = new Map();
for (const [id, connection] of this.#bag.connections) {
const schemaName = connection.type;
if (!schemaName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { BlockLoader, MEMORY_INFO_PRELOADED_MSGS } from "./BlockLoader";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";

class TestSource implements IIterableSource {
public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
return {
start: { sec: 0, nsec: 0 },
end: { sec: 10, nsec: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { BufferedIterableSource } from "./BufferedIterableSource";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";
Expand Down Expand Up @@ -43,7 +43,7 @@ function waiter(count: number) {
}

class TestSource implements IIterableSource {
public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
return {
start: { sec: 0, nsec: 0 },
end: { sec: 10, nsec: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CachingIterableSource } from "./CachingIterableSource";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";
Expand Down Expand Up @@ -70,7 +70,7 @@ class BufferedIterableSource extends EventEmitter<EventTypes> implements IIterab
// producer before exiting.
#producer?: Promise<void>;

#initResult?: Initalization;
#initResult?: Initialization;

// How far ahead of the read head we should try to keep buffering
#readAheadDuration: Time;
Expand All @@ -93,7 +93,7 @@ class BufferedIterableSource extends EventEmitter<EventTypes> implements IIterab
this.#source.on("loadedRangesChange", () => this.emit("loadedRangesChange"));
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
this.#initResult = await this.#source.initialize();
return this.#initResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ import { CachingIterableSource } from "./CachingIterableSource";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";

class TestSource implements IIterableSource {
public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
return {
start: { sec: 0, nsec: 0 },
end: { sec: 10, nsec: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Range } from "@lichtblick/suite-base/util/ranges";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";
Expand Down Expand Up @@ -84,7 +84,7 @@ class CachingIterableSource extends EventEmitter<EventTypes> implements IIterabl
// Cache of loaded ranges. Ranges correspond to the cache blocks and are normalized in [0, 1];
#loadedRangesCache: Range[] = [{ start: 0, end: 0 }];

#initResult?: Initalization;
#initResult?: Initialization;

#totalSizeBytes: number = 0;

Expand All @@ -108,7 +108,7 @@ class CachingIterableSource extends EventEmitter<EventTypes> implements IIterabl
this.#maxBlockSizeBytes = opt?.maxBlockSize ?? 52428800; // 50MB
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
this.#initResult = await this.#source.initialize();
return this.#initResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from "@lichtblick/suite-base/players/types";
import { RosDatatypes } from "@lichtblick/suite-base/types/RosDatatypes";

export type Initalization = {
export type Initialization = {
start: Time;
end: Time;
topics: Topic[];
Expand Down Expand Up @@ -154,7 +154,7 @@ export interface IIterableSource {
/**
* Initialize the source.
*/
initialize(): Promise<Initalization>;
initialize(): Promise<Initialization>;

/**
* Instantiate an IMessageIterator for the source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ import { mockTopicSelection } from "@lichtblick/suite-base/test/mocks/mockTopicS
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";
import { IterablePlayer } from "./IterablePlayer";

class TestSource implements IIterableSource {
public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
return {
start: { sec: 0, nsec: 0 },
end: { sec: 1, nsec: 0 },
Expand Down Expand Up @@ -547,7 +547,7 @@ describe("IterablePlayer", () => {

it("provides error message for inconsistent topic datatypes", async () => {
class DuplicateTopicsSource implements IIterableSource {
public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
return {
start: { sec: 0, nsec: 0 },
end: { sec: 1, nsec: 0 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { MessageEvent, Metadata } from "@lichtblick/suite";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "@lichtblick/suite-base/players/IterablePlayer/IIterableSource";
Expand Down Expand Up @@ -48,7 +48,7 @@ export class McapIndexedIterableSource implements IIterableSource {
this.#reader = reader;
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
let startTime: bigint | undefined;
let endTime: bigint | undefined;
for (const chunk of this.#reader.chunkIndexes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { RemoteFileReadable } from "./RemoteFileReadable";
import {
IIterableSource,
IteratorResult,
Initalization,
Initialization,
MessageIteratorArgs,
GetBackfillMessagesArgs,
} from "../IIterableSource";
Expand Down Expand Up @@ -55,7 +55,7 @@ export class McapIterableSource implements IIterableSource {
this.#source = source;
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
const source = this.#source;

switch (source.type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { MessageEvent, Metadata } from "@lichtblick/suite";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "@lichtblick/suite-base/players/IterablePlayer/IIterableSource";
Expand All @@ -47,7 +47,7 @@ export class McapUnindexedIterableSource implements IIterableSource {
this.#options = options;
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
if (this.#options.size > 1024 * 1024 * 1024) {
// This provider uses a simple approach of loading everything into memory up front, so we
// can't handle large files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type {
GetBackfillMessagesArgs,
IIterableSource,
IMessageCursor,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
IterableSourceInitializeArgs,
Expand All @@ -38,7 +38,7 @@ export class WorkerIterableSource implements IIterableSource {
this.#args = args;
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
this.#disposeRemote?.();

// Note: this launches the worker.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
GetBackfillMessagesArgs,
IIterableSource,
IMessageCursor,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "./IIterableSource";
Expand All @@ -26,7 +26,7 @@ export class WorkerIterableSourceWorker implements IIterableSource {
this._source = source;
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
return await this._source.initialize();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { basicDatatypes } from "@lichtblick/suite-base/util/basicDatatypes";
import {
GetBackfillMessagesArgs,
IIterableSource,
Initalization,
Initialization,
IteratorResult,
MessageIteratorArgs,
} from "../IIterableSource";
Expand All @@ -39,7 +39,7 @@ export class RosDb3IterableSource implements IIterableSource {
this.#files = files;
}

public async initialize(): Promise<Initalization> {
public async initialize(): Promise<Initialization> {
const res = await fetch(
// foxglove-depcheck-used: babel-plugin-transform-import-meta
new URL("@foxglove/sql.js/dist/sql-wasm.wasm", import.meta.url).toString(),
Expand Down
Loading
Loading