-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
145 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {FileLoader} from "./file-loader" | ||
import {LoadContext} from "./load-context" | ||
import {QueryLoader} from "./query-loader" | ||
import {LoaderRef} from "./types" | ||
|
||
export const DEFAULT_LOADERS = [ | ||
{ | ||
name: "fileLoader", | ||
initialize: (ctx: LoadContext) => new FileLoader(ctx), | ||
}, | ||
{ | ||
name: "queryLoader", | ||
initialize: (ctx: LoadContext) => new QueryLoader(ctx), | ||
}, | ||
] as LoaderRef[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import {LoadContext} from "./load-context" | ||
import {Loader} from "./types" | ||
|
||
export class QueryLoader implements Loader { | ||
constructor(private ctx: LoadContext) {} | ||
|
||
when() { | ||
return this.ctx.files.length === 0 && !!this.ctx.query | ||
} | ||
|
||
async run() { | ||
this.ctx.setProgress(0) | ||
const client = await this.ctx.createClient() | ||
const res = await client.query(this.loadQuery).then((r) => r.js()) | ||
console.log(res) | ||
this.ctx.setProgress(1) | ||
} | ||
|
||
private get loadQuery() { | ||
// This is the load op syntax | ||
// load <pool>[@<branch>] [author <author>] [message <message>] [meta <meta>] | ||
return [ | ||
this.ctx.query, | ||
"| load", | ||
this.ctx.poolId + "@" + this.ctx.branch, | ||
"author " + JSON.stringify(this.ctx.author), | ||
"message " + JSON.stringify(this.ctx.body), | ||
].join(" ") | ||
} | ||
} | ||
|
||
export function addLoad(query: string, poolId) { | ||
return query + " | load " + poolId | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
import {LoadFormat} from "@brimdata/zed-js" | ||
import {LoadContext} from "./load-context" | ||
import {LoadReference} from "src/js/state/Loads/types" | ||
|
||
export type LoadOptions = { | ||
windowId: string | ||
lakeId: string | ||
poolId: string | ||
branch: string | ||
branch?: string | ||
files: string[] | ||
shaper: string | ||
query?: string | ||
shaper?: string | ||
format?: LoadFormat | ||
author: string | ||
body: string | ||
} | ||
|
||
export interface Loader { | ||
when(context: LoadContext): PromiseLike<boolean> | boolean | ||
run(context: LoadContext): PromiseLike<void> | void | ||
rollback(context: LoadContext): PromiseLike<void> | void | ||
when(): PromiseLike<boolean> | boolean | ||
run(): PromiseLike<void> | void | ||
rollback?(): PromiseLike<void> | void | ||
} | ||
|
||
export type LoadEvents = { | ||
success: (load: LoadReference) => void | ||
abort: (load: LoadReference) => void | ||
error: (load: LoadReference) => void | ||
} | ||
|
||
export type LoaderRef = { | ||
name: string | ||
initialize: (ctx: LoadContext) => Loader | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,9 @@ const Toaster = () => { | |
success: { | ||
duration: 6000, | ||
}, | ||
error: { | ||
duration: 15_000, | ||
}, | ||
}} | ||
/> | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.