Git Product home page Git Product logo

fressian-clr's Introduction

Fressian CLR

This is a direct port of the Java Fressian Project to the CLR. The Getting Started Documentation for Java can be found here

What is Fressian?

Fressian is an extensible binary data notation. It is inspired by, and shares many design objectives with hessian and edn.

CLR Implementation Notes

This is a CLR port of the fressian project implemented for the JVM. This is the first iteration of the port, and the java source code was used as a basis to the code organization. Future efforts may involve making the API more idomatic to CLR developers.

Platform Notes

Mapped Types

Below are the native fressian type to clr type mappings:

  • int -> long
  • bool -> bool
  • bytes -> byte[]
  • double -> double
  • float -> float
  • string -> String
  • list -> System.Collections.Generic.IList<object>
  • set -> System.Collections.Generic.ISet<object>
  • map -> System.Collections.Generic.IDictionary<object, object>
  • uuid -> System.Guid
  • regex -> System.Text.RegularExpressions.Regex
  • uri -> System.Uri
  • bigint -> System.Numerics.BigInteger
  • bigdec -> System.Decimal (see BigDecimal support below)
  • inst -> System.DateTime
BigDecimal Support

Since there is not a native BigDecimal equivilent on the CLR, only partial BigDecimal support was implemented in fressian-clr. If the big decimal value exceeds 96 bits (the size of the Decimal type in the CLR), an OverflowException will be thrown.

Examples

The ./test/apps/fressian-server project is a sample Fressian echo server. It is a test project that when run with no arguments, launches a Tcp Server on port 19876. When fressian-server.exe is passed a numeric argument [n] from the command line, it will act as a test client and transmit [n] number of random doubles to the fressian echo server.

The protocol of the fressian echo server is as follows:

  • client sends a big-endian 64 bit long value indicating the number of fressian objects that are going to be written to the socket
  • server responds with the big-endian 64 bit long that was sent
  • client sends the same number of fressian objects as initially indicated
  • server reads all objects, and then will echo them back to the client

Tests

Unit Tests

The java fressian tests were all written using test.generative 0.1.4. A CLR port of data.generators called data.generators-clr was used for test data when porting these fressian tests. The data.generators-clr project is referenced as a git submodule in ./submodules/data.generators-clr.

For these tests, clojure-clr 1.4.1 was used and is directly reference in the bin/repl.bat file. The fressian project must first be compiled in orderfor the ./script/runtests.clj script to run from this repl, since it needs to load the fressian.dll assembly first.

Cross Platform Testing

Cross platform testing was conducted using the included fressian-server example project. Test data was roundtripped from CLR -> Java, CLR -> CLR, and Java -> CLR using this server.

License

Copyright Metadata Partners, LLC.

Licensed under the EPL. (See the file epl.html.)

fressian-clr's People

Contributors

ffailla avatar

Watchers

James Cloos avatar RG avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.