Giter VIP home page Giter VIP logo

guble's People

Contributors

bogh avatar codacy-badger avatar everesio avatar marian-craciunescu avatar pathway27 avatar thees avatar tkrille avatar

Stargazers

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

Watchers

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

guble's Issues

Test_DummyMessageStore_SyncIds fails occasionaly.

--- FAIL: Test_DummyMessageStore_SyncIds (0.01s)
        Error Trace:    dummy_message_store_test.go:66
    Error:      Should be true

        Error Trace:    dummy_message_store_test.go:67
    Error:      Not equal: []byte{0x34, 0x32} (expected)
                    != []byte(nil) (actual)

            Diff:
            --- Expected
            +++ Actual
            @@ -1,4 +1,2 @@
            -([]uint8) (len=2 cap=8) {
            - 00000000  34 32                                             |42|
            -}
            +([]uint8) <nil>

[PN-7] Improve test Coverage of the gcm adapter

At the moment the testcoverage of the whole project is 75%. For the package of the gcm adapter this value is about 33.3%. This should be improved in this ticket. So that we at least have a test coverage about 90% in this package.
UAC:
improve test coverage for package GCM on value >= 90%
Do refactorings where needed

TODO's:

  1. Remove the http.Handler mux and use the webserverinterface.
  2. Parse the requestUri to get the /:userid/:gcmid/subscribe/*topic format and dirrectly pass to the Subscribe method. Remove the use of httprouter library and handle the subscription in one private method.

Unify the services dependent upon under the `router`

The router is the core of the app. We can have the router store all the other service thus allowing us to pass the router to all other instance and they will require the services as needed for each.

Put the AccessManager, MessageStore, KVStore in the router and allow access to them through the Router interface described in #24. For example the interface should have methods to return all this objects:

  • AccessManager() (AccessManager, error),
  • MessageStore() (MessageStore, error)
  • KVStore() (KVStore, error)

Each method should return the object required or nil thus allowing the services dependent to take action in case a dependent service is not provided.

This must be implemented prior to #16.

Define a better interface for AccessManager

AccessManager should have a IsAllowed method that receives 3 parameters:

  • Operation: (READ or WRITE)
  • UserID
  • Topic

READ operation is when a user wants to subscribe or fetch messages
WRITE operation is when a user wants to send a message.

Clean shutdown

Make sure the messages stored are sent out and no more messages are accepted.

Generic store data on a route

Atm, we have UserID and ApplicationID hardcoded in the route structure and this is not flexible. The ApplicationID is only used for the GCM connector and UserID doesn't have much use.

Message time

In the protocol do we need for message time to be supplied mandatory?
It is discarded on the server.

`MsgAndRoute` is obsolete

The channel that belongs to Route should send only message through it. No need to send the route also.

If you send through the route channel Router.C or receive you already have access to the route.
The channel should also be built inside the NewRoute constructor and not receive from exterior. Only if there aren't special cases where this is required.

Remove dependency injection from the service

Service should remain a simple service handler, starting/stopping services and handling http request.
Remove the dependency injection. The only dependent service should be the router which will provide access to all other objects.

Move the Args in own config module

Rename the Args structure to Config and move to own module config that initializes itself at load and contains the config in a public variable, thus all modules would have access to the config and they would pick the required values, without the need to pass them around.

Nicer error message when guble is run as unprivileged user

When I try to run guble as user on linux (fedora) (built using go get, not in a docker container), I get this message:

$ guble --log-info
2016/01/12 22:35:43 ERROR (github.com/smancke/guble/store.(*SqliteKVStore).Open:124): error db directory not writeable "/var/lib/guble/kv-store.db": "mkdir /var/lib/guble: permission denied"
2016/01/12 22:35:43 error db directory not writeable "/var/lib/guble/kv-store.db": "mkdir /var/lib/guble: permission denied"
! github.com/smancke/guble/store.(*SqliteKVStore).Open:124
! github.com/smancke/guble/gubled.glob.func1:35
! github.com/smancke/guble/gubled.StartupService:108
! github.com/smancke/guble/gubled.Main:97
! main.main:11
! runtime.main:120
! runtime.goexit:1722
2016/01/12 22:35:43 ERROR (github.com/smancke/guble/gubled.Main.func1:86): mkdir /var/lib/guble: permission denied
2016/01/12 22:35:43 mkdir /var/lib/guble: permission denied
! github.com/smancke/guble/gubled.Main.func1:86
! runtime.call32:437
! runtime.gopanic:423
! github.com/smancke/guble/gubled.glob.func1:36
! github.com/smancke/guble/gubled.StartupService:108
! github.com/smancke/guble/gubled.Main:97
! main.main:11
! runtime.main:120
! runtime.goexit:1722

The problem is clear from that message, but I would prefer to catch this case and output a nice message like

guble needs to be run as root because xyz

This would improve the first experience using guble.

Also, this should be mentioned in the readme, I think

Implementing queue route

I think we should still implement the queue'd route, not closing the channel immediately if the route is full.

At the moment we store only pointers in the channels which will make the buffer low in size and thus will save the disk, because closing the channel of the subscription, will require the subscription to fetch from the disk again, and if each subscription will fetch messages it will grown more in memory, cause each message in this case will represent different values in memory, there wont be a pointer to the same message. I think reducing the disk usage is a plus, and the queue'd route is easy to implement., already done some work in this direction.

EDIT

Outlining some benefits:

  • The logic of delivering a message to the route channel goes inside the route
  • The closing mechanism is inside the route also.
  • We can decide using route params how the route will act, how much to buffer and if the channel should be closed in case of high buffer.
  • The route will have a deliver method that will take care of storing the message in the queue and it will be non-blocking.

Any thoughts?

[PN-14] Clean shutdown

The main purpose here is: Make sure the messages stored are sent out and no more messages are accepted.

  • After the Router has sent all the messages signal the Service to start to listen if all the modules finished.
  • Service should listen for each module if the work is done, after calling Stop()
  • Stop receiving messages.
  • Wait to handle all messages that were received.
  • Websocket connection must be stopped gracefully.

Suggestion here is that the Stop method should return a channel that will be closed when work is done. Or the channel could also send an error and we log the error and consider the work is done also.

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.