Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade of channel.json #94

Open
hupili opened this issue Aug 7, 2013 · 0 comments
Open

Upgrade of channel.json #94

hupili opened this issue Aug 7, 2013 · 0 comments
Milestone

Comments

@hupili
Copy link
Owner

hupili commented Aug 7, 2013

channel.json needs upgrade in order to incorporate more channel related information, e.g. rate limit confs (#25).

Original design used a list as outmost layer.... We will change it to a dict so that further extensions are transparent. Put in v1 for this interface change. The channels field will also be a dict instead of a list.

One prototype of rate limit is in sina-automator.

The full fledged channel.json may look like:

{
  "channels": {
    "ch1": {
      "channel_name": "ch1",
      "open": "yes",
      "methods": {
        "home_timeline": {
          "default_parameter": {
            "count": 30
          },
          "resource_consumption": {
            "ip": 1,
            "user1": 1,
            "app1": 1
          }
        },
        "update": {...},
        "forward": {...},
        "reply": {...}
      }
    },
    "ch2": {...},
    "ch3": {...}
  }
  "resources": {
    "ip": {
      "max": 100,
      "init": 1,
      "rate": 2
    },
    "user1": {
      ...
    },
    "user2": {
      ...
    },
    ...
    "app1": {
      ...
    },
    "app2": {
      ...
    }
  }
}

This looks hairy... I may hold back the integration of rate limit in channel.json. Those can be put into another separate conf resource.json. Since rate limit is only valid in async mode, separating them may be a better idea. Users can start with a minimum channel.json and add more ingredients later if needed.

In an afterthought, channels: [] may be better. This is to enable fast generation of a min conf:

  • Use SNSPocket.new_channel or the new_channel of individual platforms.
  • Paste the channel confs (dicts) generated in this way into a JSON list and it's done.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant