Skip to content

Commit

Permalink
Merge pull request #2 from GordonSmith/feat-comms-dfuworkunit-methods
Browse files Browse the repository at this point in the history
chore:  Remove duplication of request types
  • Loading branch information
jeclrsg committed Jun 26, 2023
2 parents 7adeb8f + 5d2b327 commit c826916
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 168 deletions.
6 changes: 3 additions & 3 deletions packages/comms/src/ecl/dfuWorkunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Cache, IEvent, scopedLogger, StateCallback, StateEvents, StateObject, S
import { IConnection, IOptions } from "../connection";
import { ESPExceptions } from "../espConnection";
import { WsSMC } from "../services/wsSMC";
import { FileSpray, FileSprayService, SprayFixedEx, SprayVariableEx, UpdateDFUWorkunitEx } from "../services/fileSpray";
import { FileSpray, FileSprayService, UpdateDFUWorkunitEx } from "../services/fileSpray";
import * as WsTopology from "../services/wsTopology";

const logger = scopedLogger("@hpcc-js/comms/dfuWorkunit.ts");
Expand Down Expand Up @@ -118,7 +118,7 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
return retVal;
}

static sprayFixed(server: IOptions | IConnection, request: Partial<SprayFixedEx>): Promise<DFUWorkunit> {
static sprayFixed(server: IOptions | IConnection, request: Partial<FileSpray.SprayFixed>): Promise<DFUWorkunit> {
const service = new FileSprayService(server);
return service.SprayFixedEx({
...request
Expand All @@ -130,7 +130,7 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
});
}

static sprayVariable(server: IOptions | IConnection, request: Partial<SprayVariableEx>): Promise<DFUWorkunit> {
static sprayVariable(server: IOptions | IConnection, request: Partial<FileSpray.SprayVariable>): Promise<DFUWorkunit> {
const service = new FileSprayService(server);
return service.SprayVariableEx({
...request
Expand Down
173 changes: 8 additions & 165 deletions packages/comms/src/services/fileSpray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,185 +4,28 @@ export {
FileSpray
};

export interface SprayFixedEx {
sourceIP?: string;
sourcePlane?: string;
sourcePath?: string;
srcxml?: string;
sourceFormat?: string;
sourceRecordSize?: number;
destGroup?: string;
destLogicalName?: string;
destNumParts?: number;
overwrite?: boolean;
replicate?: boolean;
ReplicateOffset?: number;
maxConnections?: number;
throttle?: number;
transferBufferSize?: number;
prefix?: string;
nosplit?: boolean;
norecover?: boolean;
compress?: boolean;
push?: boolean;
pull?: boolean;
noCommon?: boolean;
encrypt?: string;
decrypt?: string;
wrap?: boolean;
failIfNoSourceFile?: boolean;
recordStructurePresent?: boolean;
quotedTerminator?: boolean;
expireDays?: number;
DFUServerQueue?: string;
}

export interface SprayVariableEx {
sourceIP?: string;
sourcePlane?: string;
sourcePath?: string;
srcxml?: string;
sourceMaxRecordSize?: number;
sourceFormat?: number;
NoSourceCsvSeparator?: boolean;
sourceCsvSeparate?: string;
sourceCsvTerminate?: string;
sourceCsvQuote?: string;
sourceCsvEscape?: string;
sourceRowTag?: string;
destGroup?: string;
destLogicalName?: string;
overwrite?: boolean;
replicate?: boolean;
ReplicateOffset?: number;
maxConnections?: number;
throttle?: number;
transferBufferSize?: number;
prefix?: string;
nosplit?: boolean;
norecover?: boolean;
compress?: boolean;
push?: boolean;
pull?: boolean;
noCommon?: boolean;
encrypt?: string;
decrypt?: string;
failIfNoSourceFile?: boolean;
recordStructurePresent?: boolean;
quotedTerminator?: boolean;
sourceRowPath?: string;
isJSON?: boolean;
expireDays?: number;
DFUServerQueue?: string;
srcUsername?: string;
srcPassword?: string;
}
type UpdateDFUWorkunitMinusWU = Omit<FileSpray.UpdateDFUWorkunit, "wu">;
type UpdateDFUWorkunitWU = FileSpray.UpdateDFUWorkunit["wu"];

export interface DesprayEx {
destGroup?: string;
sourceLogicalName?: string;
destIP?: string;
destPath?: string;
destPlane?: string;
dstxml?: string;
overwrite?: boolean;
maxConnections?: number;
throttle?: number;
transferBufferSize?: number;
splitprefix?: string;
norecover?: boolean;
wrap?: boolean;
multiCopy?: boolean;
SingleConnection?: boolean;
DFUServerQueue?: string;
compress?: boolean;
encrypt?: string;
decrypt?: string;
}

export interface UpdateDFUWorkunitEx {
wu?: {
ID?: string;
DFUServerName?: string;
ClusterName?: string;
JobName?: string;
Queue?: string;
User?: string;
isProtected?: boolean;
Command?: number;
CommandMessage?: string;
PercentDone?: number;
SecsLeft?: number;
ProgressMessage?: string;
SummaryMessage?: string;
State?: number;
SourceLogicalName?: string;
SourceIP?: string;
SourceFilePath?: string;
SourceDali?: string;
SourceRecordSize?: number;
SourceFormat?: number;
RowTag?: string;
SourceNumParts?: number;
SourceDirectory?: string;
DestLogicalName?: string;
DestGroupName?: string;
DestDirectory?: string;
DestIP?: string;
DestFilePath?: string;
DestFormat?: number;
DestNumParts?: number;
DestRecordSize?: number;
Replicate?: boolean;
Overwrite?: boolean;
Compress?: boolean;
SourceCsvSeparate?: string;
SourceCsvQuote?: string;
SourceCsvTerminate?: string;
SourceCsvEscape?: string;
TimeStarted?: string;
TimeStopped?: string;
StateMessage?: string;
MonitorEventName?: string;
MonitorSub?: boolean;
MonitorShotLimit?: number;
SourceDiffKeyName?: string;
DestDiffKeyName?: string;
Archived?: boolean;
encrypt?: string;
decrypt?: string;
failIfNoSourceFile?: boolean;
recordStructurePresent?: boolean;
quotedTerminator?: boolean;
preserveCompression?: boolean;
expireDays?: number;
PreserveFileParts?: boolean;
FileAccessCost?: number;
KbPerSecAve?: number;
KbPerSec?: number;
};
ClusterOrig: string;
JobNameOrig: string;
isProtectedOrig: boolean;
StateOrig: number;
export interface UpdateDFUWorkunitEx extends UpdateDFUWorkunitMinusWU {
wu?: Partial<UpdateDFUWorkunitWU>
}

export class FileSprayService extends FileSprayServiceBase {

SprayFixedEx(request: SprayFixedEx): Promise<FileSpray.SprayFixedResponse> {
SprayFixedEx(request: Partial<FileSpray.SprayFixed>): Promise<FileSpray.SprayFixedResponse> {
return this._connection.send("SprayFixed", request);
}

SprayVariableEx(request: SprayVariableEx): Promise<FileSpray.SprayResponse> {
SprayVariableEx(request: Partial<FileSpray.SprayVariable>): Promise<FileSpray.SprayResponse> {
return this._connection.send("SprayVariable", request, "json", false, null, "SprayResponse");
}

DesprayEx(request: DesprayEx): Promise<FileSpray.DesprayResponse> {
DesprayEx(request: Partial<FileSpray.Despray>): Promise<FileSpray.DesprayResponse> {
return this._connection.send("Despray", request);
}

UpdateDFUWorkunitEx(request: UpdateDFUWorkunitEx): Promise<FileSpray.UpdateDFUWorkunitResponse> {
UpdateDFUWorkunitEx(request: Partial<UpdateDFUWorkunitEx>): Promise<FileSpray.UpdateDFUWorkunitResponse> {
return this._connection.send("UpdateDFUWorkunit", request, "json", false, undefined, "UpdateDFUWorkunitResponse");
}

}

0 comments on commit c826916

Please sign in to comment.