Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DrewMcArthur committed Feb 15, 2024
1 parent 9f99cad commit 785a110
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 54 deletions.
4 changes: 2 additions & 2 deletions Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
org = "drewmca"
name = "msgpack"
version = "0.0.6"
distribution = "2201.5.0"
version = "0.0.7"
distribution = "2201.8.4"
17 changes: 14 additions & 3 deletions Module.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
msgpack implementation in ballerina
[//]: # (above is the module summary)

# Module Overview

[see msgpack.org](https://msgpack.org)

this package exposes two functions, `encode` and `decode`,
which handle serialization to and from msgpack-encoded byte arrays.

Expand All @@ -11,13 +12,23 @@ public function encode(any data) returns byte[];
public function decode(byte[] data) returns any;
```

this package is NOT feature complete. feel free to contribute!
see [README.md](https://github.com/drewmcarthur/msgpack-bal) and repository for completion.

## usage

```bal
```
import ballerina/io;
import drewmca/msgpack;
json obj = {"hello": "world!"}
byte[] encoded = msgpack:encode(obj);
json decoded = msgpack:decode(encoded);
io:println(decoded);
```
```

## repository

[github.com/drewmcarthur/msgpack-bal](https://github.com/drewmcarthur/msgpack-bal)
6 changes: 4 additions & 2 deletions Package.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
msgpack implementation in ballerina
[//]: # (above is the package summary)

# Package Overview

[see msgpack.org](https://msgpack.org)

this package exposes two functions, `encode` and `decode`,
which handle serialization to and from msgpack-encoded byte arrays.

Expand All @@ -11,4 +12,5 @@ public function encode(any data) returns byte[];
public function decode(byte[] data) returns any;
```

so far, only implement small maps and strings, this package is a WIP.
this package is NOT feature complete. feel free to contribute!
see the readme and repository for completion.
91 changes: 44 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@ an implementation of the [msgpack](https://msgpack.org) spec in ballerina.

## how to use

i won't publish this onto ballerina central until it hits v1, so if
you'd like to use v0, you can clone the repo, package it and publish
it to your local repository:
```bash
bal pack && bal push --repository local
```
and then import it from your ballerina project by tossing this into your `Ballerina.toml` file
import it from your ballerina project by tossing this into your `Ballerina.toml` file

```toml
[[dependency]]
org="drewmca"
name="msgpack"
version="0.0.6"
repository="local"
version="0.0.7"
```

and your editor should see the module and let you use the library, something like this:

```bal
import ballerina/io;
import drewmca/msgpack;
Expand All @@ -35,66 +31,67 @@ io:println(decoded);
from the [msgpack format spec](https://github.com/msgpack/msgpack/blob/master/spec.md#formats)

- [x] nil format
- [x] nil
- [x] nil
- [x] bool format family
- [x] true
- [x] false
- [x] true
- [x] false
- [ ] int format family
- [x] PositiveFixInt
- [x] NegativeFixInt
- [x] Uint8
- [x] Uint16
- [x] Uint32
- [x] Uint64
- [x] Int8
- [x] Int16
- [x] Int32
- [ ] Int64 (not implemented bc ballerina cannot do `1 << 64`)
- [x] PositiveFixInt
- [x] NegativeFixInt
- [x] Uint8
- [x] Uint16
- [x] Uint32
- [x] Uint64
- [x] Int8
- [x] Int16
- [x] Int32
- [ ] Int64 (not implemented bc ballerina cannot do `1 << 64`)
- [ ] float format family
- [ ] Float32
- [ ] Float64
- [ ] Float32
- [ ] Float64
- [x] str format family
- [x] FixStr
- [x] Str8
- [x] Str16
- [ ] Str32 (implemented but untested)
- [x] FixStr
- [x] Str8
- [x] Str16
- [ ] Str32 (implemented but untested)
- [x] bin format family
- [x] Bin8
- [x] Bin16
- [x] Bin32 (implemented but untested)
- [x] Bin8
- [x] Bin16
- [x] Bin32 (implemented but untested)
- [x] array format family
- [x] FixArray
- [x] Array16
- [ ] Array32 (implemented but untested)
- [x] FixArray
- [x] Array16
- [ ] Array32 (implemented but untested)
- [x] map format family
- [x] FixMap
- [x] Map16
- [ ] Map32 (implemented but untested)
- [x] FixMap
- [x] Map16
- [ ] Map32 (implemented but untested)
- [ ] ext format family
- [ ] Ext8
- [ ] Ext16
- [ ] Ext32
- [ ] FixExt1
- [ ] FixExt2
- [ ] FixExt4
- [ ] FixExt8
- [ ] FixExt16
- [ ] Ext8
- [ ] Ext16
- [ ] Ext32
- [ ] FixExt1
- [ ] FixExt2
- [ ] FixExt4
- [ ] FixExt8
- [ ] FixExt16
- [ ] Timestamp extension type

## Roadmap

This is a quick and dirty implementation, generally building out functionality first and will refactor after.

- **v0.3**: implementation of some, but not all of the spec. quick & dirty implementation.
- **v0.3**: implementation of some, but not all of the spec. quick & dirty implementation.
- **v0.4**: added benchmarks, coreutil for int->byte[] map16, str, & int impl
- **v0.5**: implemented maps and arrays, also refactored decoding to pop bytes off as it goes
- **v0.6**: implemented binary byte arrays, introduced some better error handling
- **v0.7**: version bump for updating docs and pushing to bal central
- **v1.0**: full compatibility with the msgpack spec, including a full test suite and benchmarks

### TODO:

- [ ] create a big json file of test cases
- [x] put a checkbox of msgpack format types here
- [x] put a checkbox of msgpack format types here
- [x] separate functions into different files
- [x] refactor decoding to pop bytes off the array
- [ ] test long array/map values

0 comments on commit 785a110

Please sign in to comment.