Skip to content

Pure rust implementation of the wire protocol#22

Merged
jairinhohw merged 43 commits intomasterfrom
pure_rust
Aug 25, 2020
Merged

Pure rust implementation of the wire protocol#22
jairinhohw merged 43 commits intomasterfrom
pure_rust

Conversation

@jairinhohw
Copy link
Collaborator

@jairinhohw jairinhohw commented Aug 5, 2020

Work in progress implementation of the wire protocol in rust.

Resources to help:
Protocol Messages
Implementation in python
Firebird source code explorer
Firebird wire protocol documentation

Closes #13

@fernandobatels
Copy link
Owner

Running the tests into pure_rust branch, I got this result:

---- ibase::wire::connection_test stdout ----
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Other("Invalid server response, missing bytes")', src/ibase/wire.rs:309:20

---- params::test::dates stdout ----
thread 'main' panicked at 'Error on connect the test database: Other("Invalid server response, missing bytes")', src/params.rs:446:20

So I changed the ProtocoloVersion enum and the 'protocolos' array into connect(), enabling the V13(my firebird server is the 3.0.4). Now, the tests result in this:

---- ibase::wire::connection_test stdout ----
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Other("Connection rejected with code 92")', src/ibase/wire.rs:309:20

---- params::test::dates stdout ----
thread 'main' panicked at 'Error on connect the test database: Other("Connection rejected with code 92")', src/params.rs:446:20

@fernandobatels
Copy link
Owner

fernandobatels commented Aug 5, 2020

@juarezr, you can help us running the tests of this PR?

@juarezr
Copy link
Contributor

juarezr commented Aug 5, 2020

@fernandobatels

  • There is something specific that you need help?
  • What's the strategy for testing? Comparing pure rust vs libfbclient implementations?

@jairinhohw
Copy link
Collaborator Author

@juarezr, right now, this fork should work with firebird versions below 3.0 or 3.0 and above with the Legacy_Auth plugin enabled.

To work with Firebird 3.+ without Legacy_Auth i am working on implementing the wire protocol 13.

You can help by running the tests and creating new tests if you want.
Help by reviewing the implementation is welcome if you have some knowledge of rust or the firebird wire protocol.

@juarezr
Copy link
Contributor

juarezr commented Aug 6, 2020

Maybe I can setup a CI with Github actions for pull request validation and for release if this is desired.

Help by reviewing the implementation is welcome if you have some knowledge of rust or the firebird wire protocol.

I barely know how firebird wire protocol works, but I'll need to further study and research. I'll try to get some spare time to help here.

@fernandobatels
Copy link
Owner

Maybe I can setup a CI with Github actions for pull request validation and for release if this is desired.

I had in mind to do that, but if you can help, will be nice. You can make a pull request with your github actions for test the lib.

I think we need actions(or steeps) for test the 3.* and 2.* firebird versions, especially the wire implementation

@fernandobatels
Copy link
Owner

@juarezr, If you want, you can join us on the https://t.me/rsfbclient

@juarezr
Copy link
Contributor

juarezr commented Aug 6, 2020

I think we need actions(or steeps) for test the 3.* and 2.* firebird versions, especially the wire implementation

I'll try to setup a action for handling tests between FirebirdSQL versions triggering on each pull request.

@jairinhohw
Copy link
Collaborator Author

Should work with firebird 3 now

@fernandobatels
Copy link
Owner

Should work with firebird 3 now

All tests passing here

@fernandobatels
Copy link
Owner

Should work with firebird 3 now

What is the next steps now? Fix the ignored tests?

@jairinhohw
Copy link
Collaborator Author

There is still a bit of TODOs to fix and some tests i need to add, like a select with a lot of fields will not receive all columns because of one TODO.
Needs to implement (#23) to work alongside the native implementation. I'm thinking of separating the lib in 4 crates.

  • rsfbclient will have the high level api and features for the native, dynamic_loading and pure_rust implementations.
  • rsfbclient-core will have the constants and traits to allow the high level connection in rsfbclient to be generic over the low level implementation.
  • rsfbclient-native will have the code for the native and dynamic_loading versions, as they both use the libfbclient shared library (will implement the traits of rsfbclient-core).
  • rsfbclient-rustwill have the code for the pure_rust version (will implement the traits of rsfbclient-core).

@juarezr
Copy link
Contributor

juarezr commented Aug 18, 2020

Awesome!

This is starting to work!

And coverage is starting to spread over all code (75%)!

@jairinhohw jairinhohw marked this pull request as ready for review August 21, 2020 17:08
and fixed some panics found with it
@jairinhohw jairinhohw requested a review from juarezr August 24, 2020 20:58
@fernandobatels
Copy link
Owner

All tests working here. For me, we can merge.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Pure rust implementation

4 participants