Skip to content

Upgrade of channel.json #94

@hupili

Description

@hupili

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions