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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃帀 feat v0.1 #2

Merged
merged 12 commits into from Dec 28, 2023
Merged

馃帀 feat v0.1 #2

merged 12 commits into from Dec 28, 2023

Conversation

jkcs
Copy link
Contributor

@jkcs jkcs commented Dec 19, 2023

Fixes skytable/skytable#324
/claim skytable/skytable#324

TODO LIST

  • Test the usability

@ohsayan
Copy link
Member

ohsayan commented Dec 19, 2023

Great work @jkcs! I'll review this in a few moments.

@jkcs
Copy link
Contributor Author

jkcs commented Dec 20, 2023

@ohsayan Thank you for the help you provided on Discord. After testing and fixing it, everything is working perfectly now. As for the suggestion you made about refactoring it into bl, can we postpone it for now? (I have less free time available currently.)

@jkcs
Copy link
Contributor Author

jkcs commented Dec 20, 2023

Just a side note, there are some errors and omissions in the content of the "Networking" section at https://docs.skytable.io/protocol/networking. It seems that Skytable also has a bug regarding the return of integer types. Once I find the steps to reproduce it, I will raise an issue.

@glydr glydr requested a review from ohsayan December 23, 2023 04:47
Copy link
Member

@ohsayan ohsayan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Would be great if you can add some documentation comments.

Comment on lines -1 to -13
export class Query {
private query_buffer: Uint8Array;
private param_buffer: Uint8Array;
private param_cnt: number;

/**
* Create a new query with the base query set. You can now add (any) additional parameters.
*
* @param query The base query
*/
constructor(query: string) {
this.query_buffer = new Uint8Array(Buffer.from(query, 'utf-8'));
this.param_buffer = new Uint8Array();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a Query object! This will allow adding multiple parameters, say in a loop for example.

src/config.ts Outdated
return createSkytable(connect);
}

async connectTSL(options: ConnectionTLSOptions) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is a typo. It should be TLS

src/protocol.ts Outdated
return [PARAMS_TYPE.BOOLEAN, Number(param) === 1 ? '\x01' : 0].join(
'',
);
default:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe to do? If there is a custom type we can't assume it to be a binary blob

src/skytable.ts Outdated

export type QueryResult = Column | Row | Rows;

export function createSkytable(connection: Socket | TLSSocket) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this function is exported, I think we'll want to call it something like createConnection or connectDB

@jkcs
Copy link
Contributor Author

jkcs commented Dec 23, 2023

@ohsayan The points you mentioned have all been updated

@jkcs
Copy link
Contributor Author

jkcs commented Dec 25, 2023

@ohsayan The buffer.subarray() method returns a new Buffer object that shares memory with the original Buffer object. It allows you to access a portion of the original Buffer object without copying the memory.

I think it's unnecessary for us to refactor the performance improvements into bl. The slice method in Buffer is already deprecated, and using subarray is considered best practice.

@jkcs jkcs requested a review from ohsayan December 25, 2023 07:22
Copy link
Member

@ohsayan ohsayan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I attempted to import the package to test with this package.json:

{
  "name": "jsclient-testbench",
  "version": "1.0.0",
  "main": "dist/index.ts",
  "author": "Sayan Nandan <nandansayan@outlook.com>",
  "license": "Apache-2.0",
  "devDependencies": {
    "typescript": "^5.3.3"
  },
  "dependencies": {
    "skytable": "github:jkcs/client-nodejs#feat/v0.1"
  },
  "scripts": {
    "build": "tsc",
    "start": "tsc && node dist/index.js"
  }
}

and with contents in src/index.ts:

import {Config} from 'skytable';

const cfg = new Config("root", "pass");

Are the exports set up correctly to be accessed like this? If not, what is the export structure. An integration test like example would really help!

src/config.ts Show resolved Hide resolved
@jkcs

This comment was marked as resolved.

@jkcs

This comment was marked as resolved.

@jkcs

This comment was marked as resolved.

@glydr glydr requested a review from ohsayan December 28, 2023 05:05
Copy link
Member

@ohsayan ohsayan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkcs thanks for your comment. We already have the publish script set up at publish-npm.yml so don't worry!

I completely forgot about the fact that with GH as the source it won't build.

@ohsayan ohsayan merged commit 075a4db into skytable:next Dec 28, 2023
1 check passed
@ohsayan
Copy link
Member

ohsayan commented Dec 28, 2023

鈿狅笍 This does not handle unbuffered cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement NodeJS client driver
2 participants