Git Product home page Git Product logo

de.setf.thrift's People

Contributors

html avatar lisp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

de.setf.thrift's Issues

Example usage

Hi James,

I'm trying to use this library in a slightly uncommon way: just to serialize data (the purpose is to compare different serialization methods, like: protocol-buffers, bson etc).

For that I use a simple example of a file-system hierarchy, that can be expressed in sexp form like this:

("root" :owner "root" :group "adm" :rights (7 5 5)
  ("docs" :owner "root" :group "adm" :rights (7 5 5)
    ("article.pdf" :owner "root" :group "adm" :rights (6 4 4)
                   "This is a sample article. It's rather short")
    ("example.pdf" :owner "root" :group "adm" :rights (6 4 4)
                   "123456")
    ("example.pdf~" :owner "root" :group "adm" :rights (6 4 0)
                    "And this is a backup of example.pdf")))

I've tried to implement it with the following structures:

(thrift:def-enum "node-type"
  (("FILE" . 1)
   ("DIR"  . 2)))

 (thrift:def-struct "rights"
   ((u 0 :type 'byte :id 1)
    (g 0 :type 'byte :id 2)
    (o 0 :type 'byte :id 3)))

 (thrift:def-struct "node"
  ((type nil :type 'node-type :id 1)
   (name nil :type 'string :id 2)
   (owner nil :type 'string :id 3)
   (group nil :type 'string :id 4)
   (rights nil :type 'rights :id 5)
   (content nil :type 'string :optional t :id 6)
   (nodes nil :type '(list node) :optional t :id 7)))

Then I've tried to encode them in binary form with thrift:stream-write-struct, but it failed (with the following error: There is no applicable method for the generic function #<STANDARD-GENERIC-FUNCTION ORG.APACHE.THRIFT.IMPLEMENTATION::STREAM-WRITE-FIELD-BEGIN (1)> when called with arguments (#<ORG.APACHE.THRIFT:BINARY-PROTOCOL {B43ED99}> TYPE 'NODE-TYPE 1).)

After a lot of searching I came to the conclusion, that Thrift in general and its client libraries (like this one in particular) really lack in terms of good and rich examples of IDL definitions and usage. Maybe, you could spend some time to create such example, using my data as a starting point? Or at least provide clues, how to move forward, and I'll try to create the example myself.

Thanks!
Vsevolod

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.