Giter VIP home page Giter VIP logo

kvs's Issues

kvs:add new entry leads to error badarg

I have created a new table with mnesia.

mnesia:schema(text).
-- Properties for text table --- 
access_mode          -> read_write
active_replicas      -> [nonode@nohost]
all_nodes            -> [nonode@nohost]
arity                -> 4
attributes           -> [id,title,body]
checkpoints          -> []
commit_work          -> []
cookie               -> {{1514407290293049786,-576460752303422623,1},
                         nonode@nohost}
disc_copies          -> [nonode@nohost]
disc_only_copies     -> []
external_copies      -> []
frag_properties      -> []
index                -> []
index_info           -> {index,bag,[]}
load_by_force        -> false
load_node            -> nonode@nohost
load_order           -> 0
load_reason          -> local_only
local_content        -> false
majority             -> false
master_nodes         -> []
memory               -> 306
ram_copies           -> []
record_name          -> text
record_validation    -> {text,4,bag}
setorbag             -> bag
size                 -> 0
snmp                 -> []
storage_properties   -> []
storage_type         -> disc_copies
subscribers          -> []
user_properties      -> []
version              -> {{2,0},[]}
where_to_commit      -> [{nonode@nohost,disc_copies}]
where_to_read        -> nonode@nohost
where_to_wlock       -> {[nonode@nohost],false}
where_to_write       -> [nonode@nohost]
wild_pattern         -> {text,'_','_','_'}

Now I try to add an entry via

event(submit) ->
    Title = wf:q(title),
    Body = wf:q(body),
    kvs:add(#text{id=kvs:next_id("text",1),title=Title,body=Body});

but get

<<"g2gCaAVkAAJldmQABXNtb2tlZAAGc3VibWl0bQAAAAZzdWJtaXRkAAVldmVudGgDYgAABepiAAY3fGIAC32Q">>,
                                                                                        [{{"submit",<<"detail">>},[]},
                                             {title,"Test title"},
                                                                                          {body,"Test body"}]}
n2o_nitrogen:Catch: error:badarg
                                [{erlang,atom_to_list,[<<"Test title">>],undefined},
                                                                               {kvs,rname,1,383},
                                                                                                  {kvs,range,2,334},
              {kvs,get,3,261},
                               {kvs,ensure_link,2,103},
                                                        {n2o_nitrogen,html_events,2,73},
                                                                                         {n2o_nitrogen,info,3,35},
            {n2o_proto,push,5,44}]

And I am unable to insert a new record.

What am I missing?

Thank you!

Edit: It works well when I attemt to insert a new record with mnesia

insert () ->
	Record = #text{id=1,title="Test title",body="Test body"},
	F = fun() ->
		mnesia:write(Record)
	end,

	mnesia:transaction(F).

leads to

database_logic:insert().
{atomic,ok}

and

kvs:all(text).
[{text,1,"Test title","Test body"}]

Use some semantic versioning

Would you mind using some kind of semantic versioning?

Right now the README promises a lot of features, but have you delivered them all?

If not, then at what stage are you?

I understand that this is a working progress, but having some version could have the potential users.

And probably prevent contributors to step on each other's toes.

undefined function mongo:command/2

Hello every one,
I have been following the readme instructions related to mongodb. The kvs module gives me this
settings:
>kvs:config(dba). store_mongo
>kvs:version(). {version,"KVS MONGO"}
Then after kvs:join().
I got the error message.
I don't see any 'mongo.erl' module in comtihon/mongodb-erlang sources nore in kvs's package.
Would you help me understand my wrongs?
Thanks for your time,
Best regards

feed/2 API

Successful scenario:

> require ERP
ERP
> :kvs.feed '/crm/towns', KVS.kvs(mod: :kvs_mnesia, st: :kvs_stream)

Move id_seq to separate schema

id_seq is table required for store_mnesia:next_id/2 to work. And now id_seq is defined in kvs_subscription schema.

So, it should be moved to something like kvs_system schema. Or there could be a note in readme that kvs_subscription is required.

kvs_stream:remove

It looks like kvs_stream:remove doesn't actually delete Rec from DB - only counter in writer is updated.

API breakdown: replace STRING to ATOM in id_seq

  • create(ContainerName) -> create(ContainerName, kvs:next_id(atom_to_list(ContainerName), 1)).

    atom_to_list(ContainerName)

  • [ Init(atom_to_list(Name)) || {Name,_Fields} <- containers() ].

    atom_to_list(Name)

etc.

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.