Skip to content

Commit

Permalink
chore: make more public interfaces for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey Zorkaltsev committed Oct 9, 2024
1 parent 6608df0 commit fbee6e5
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions src/topic/topic-client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {InternalWriteStreamInitArgs} from "./internal/internal-topic-write-stream";
import {InternalReadStreamInitArgs} from "./internal/internal-topic-read-stream";
import {TopicWriter} from "./topic-writer";
import {Context, ensureContext} from "../context";
import {IClientSettings} from "../client/settings";
Expand All @@ -10,6 +8,26 @@ import {InternalTopicClient} from "./internal/internal-topic-client";

// TODO: Consider support for "operationParams?: (Ydb.Operations.IOperationParams|null);". It presents in eve+ry jdbc operation

export type ICreateWriterArgs = {
path: string;
producerId?: (string|null);
writeSessionMeta?: ({ [k: string]: string }|null);
messageGroupId?: (string|null);
partitionId?: (number|Long|null);
getLastSeqNo?: (boolean|null);
}
export type ICreateReaderArgs = {
receiveBufferSizeInBytes: number;
topicsReadSettings: {
path: string;
partitionIds?: ((number|Long)[]|null);
maxLag?: (google.protobuf.IDuration|null);
readFrom?: (google.protobuf.ITimestamp|null);
}[];
consumer?: (string|null);
readerName?: (string|null);

}
export type ICommitOffsetArgs = {
path: (string|null);
partitionId?: (number|Long|null);
Expand Down Expand Up @@ -151,19 +169,19 @@ export class TopicClient {
}

// @ts-ignore
public createWriter(args: InternalWriteStreamInitArgs): TopicWriter;
public createWriter(ctx: Context, args: InternalWriteStreamInitArgs): TopicWriter;
public createWriter(args: ICreateWriterArgs): TopicWriter;
public createWriter(ctx: Context, args: ICreateWriterArgs): TopicWriter;
@ensureContext(true)
public async createWriter(ctx: Context, args: InternalWriteStreamInitArgs) {
public async createWriter(ctx: Context, args: ICreateWriterArgs) {
if (args.getLastSeqNo === undefined) args = {...args, getLastSeqNo: true};
return new TopicWriter(ctx, args, this.settings.retrier, this.settings.discoveryService, this.settings.logger);
}

// @ts-ignore
public createReader(args: InternalReadStreamInitArgs): TopicReader;
public createReader(ctx: Context, args: InternalReadStreamInitArgs): TopicReader;
public createReader(args: ICreateReaderArgs): TopicReader;
public createReader(ctx: Context, args: ICreateReaderArgs): TopicReader;
@ensureContext(true)
public async createReader(ctx: Context, args: InternalReadStreamInitArgs) {
public async createReader(ctx: Context, args: ICreateReaderArgs) {
return new TopicReader(ctx, args, this.settings.retrier, this.settings.discoveryService, this.settings.logger);
}

Expand Down

0 comments on commit fbee6e5

Please sign in to comment.