Skip to content

ThorTech/fressian-clr

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.)

About

CLR port of fressian

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published