Skip to content

Commit

Permalink
v0.0.1 rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
dzh committed Apr 13, 2018
1 parent 874ff42 commit ff99777
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 29 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dimit
分布式流控系统

## 快速开始
- pom依赖
- [maven](http://search.maven.org/#search%7Cga%7C1%7Cdimit)加pom依赖

```xml
<dependencies>
Expand Down Expand Up @@ -97,8 +97,5 @@ dimiter.close();
- [工程源码](doc/dimit_project.md)
- [数据模型](doc/dimit_store.md)
- [配置说明](doc/dimit_conf.md)
- [版本记录](doc/release_note.md)
- [发布记录](doc/release_note.md)

## TODO
- Web管理
- 通道自动恢复
2 changes: 1 addition & 1 deletion dimit-admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.github.dzh</groupId>
<artifactId>dimit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<artifactId>dimit-admin</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion dimit-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.github.dzh</groupId>
<artifactId>dimit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<artifactId>dimit-core</artifactId>

Expand Down
6 changes: 3 additions & 3 deletions dimit-core/src/main/java/dimit/core/ChannelStatWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class ChannelStatWorker implements Closeable {
private String name;

ChannelStatWorker() {
this("ChannelStatWorker", 1000L, 3000L);
this(1000L, 3000L);
}

ChannelStatWorker(long snapshotMs, long syncMs) {
this("ChannelStatWorker", snapshotMs, syncMs);
this(ChannelStatWorker.class.getSimpleName(), snapshotMs, syncMs);
}

ChannelStatWorker(String name, long snapshotMs, long syncMs) {
Expand All @@ -56,7 +56,7 @@ public String name() {
}

public void start() {
LOG.info("{} start {}ms {}ms ", name, snapshotMs, syncMs);
LOG.info("{} start snapshot-{} sync-{}", name, snapshotMs, syncMs);
SnapshotThread snapshotT = new SnapshotThread(name);
snapshotT.start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
*/
public interface ChannelCallable<V> extends Callable<V> {

int CODE_FATAL = -1; // 严重的错误,通道直接
int CODE_FATAL = -1; // 严重的错误,通道状态设置为Invalid
int CODE_SUCC = 0;
int CODE_FAIL = 1; // 普通的错误

/**
* @param v
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public int calcPriority() { // TODO conf

/**
* NotThreadSafe
*
*
*/
public void snapshot() {
long ct = System.currentTimeMillis();
Expand Down Expand Up @@ -157,15 +157,15 @@ public void writeChannelStat() throws IOException {
DimitPath statPath = dss.getPath(StoreConst.PATH_STORE, channel.conf().getId(), "stat" + channel.store().getType().getNumber(),
channel.id());
dss.<ChannelStat> io().write(statPath, stat, StoreAttribute.EPHEMERAL);
LOG.info("create EPHEMERAL stat {}", statPath);
LOG.info("create EPHEMERAL stat {} {}", statPath, stat);
}
}

/**
* double tps = 8;
* double avgTime = 11;
* double succRate = 12;
*
*
* @param preStat
* @param stat
*/
Expand Down Expand Up @@ -215,7 +215,7 @@ public String toString() {

/**
* for test
*
*
* @return
*/
@Deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ public <V> V call(ChannelCallable<V> c) throws Exception {
stat.incrCount();
stat.addTime(interval);

switch (c.code(v)) { // TODO
switch (c.code(v)) {
case ChannelCallable.CODE_SUCC: {
stat.incrSuccCount();
stat.addSuccTime(interval);
break;
}
case ChannelCallable.CODE_FATAL: {
invalid();
throw new InvalidChannelException("Invalid ChannelConf:" + conf.getId() + ", code:-1");
throw new InvalidChannelException("Invalid ChannelConf:" + conf.getId() + " code:" + ChannelCallable.CODE_FATAL);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion dimit-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.github.dzh</groupId>
<artifactId>dimit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<artifactId>dimit-demo</artifactId>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion dimit-redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.github.dzh</groupId>
<artifactId>dimit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<artifactId>dimit-redis</artifactId>
</project>
2 changes: 1 addition & 1 deletion dimit-store/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.github.dzh</groupId>
<artifactId>dimit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<artifactId>dimit-store</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion dimit-zk/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.github.dzh</groupId>
<artifactId>dimit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
</parent>
<artifactId>dimit-zk</artifactId>

Expand Down
6 changes: 3 additions & 3 deletions doc/dimit_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ DimitStoreSystem


## 存储结构
- 示例说明 dimit-zk://domain/path
- 示例说明 URI: `dimit-zk://domain/path`

```
/path
Expand All @@ -28,7 +28,7 @@ DimitStoreSystem
DimitConf_N // 分流器定义
ChannelGroupConf_N // 通道组定义
ChannelConf_N // 通道配置
store //运行时信息
store // 运行时信息
DimitConf_N_ID // DimitConf_N的ID 读取Dimiter所在机器的基本服务器信息
Dimit_ID // Dimit实例,临时节点
ChannelConf_N_ID // ChannelConf_N的ID
Expand All @@ -43,7 +43,7 @@ DimitStoreSystem
```

- 运行时更新
- 不可用状态的通道不在更新统计信息 stat_0 stat_1 stat
- 不可用状态的通道不会更新统计信息 stat_0 stat_1



Expand Down
12 changes: 8 additions & 4 deletions doc/release_note.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
==========================


## v0.0.2 2018-04-20 TODO
- 发布dimit-admin Web管理功能
- 编辑doc/dimit_conf.md 配置参数说明
## v0.0.2 2018-xx-xx TODO
- Web管理功能 dimit-admin
- 编辑doc/dimit_conf.md配置参数说明
- 自定义切换策略
- 增加Channel从Invalid状态恢复的自动机制
- Dimiter的Master选举机制, 清理store、ChannelTotalStat统计等


## v0.0.1 2018-04-13
Expand All @@ -16,4 +18,6 @@
- 主备切换
- ChannelConf定义通道ChannelStatus, select返回的可用通道列表里PRIMARY优先于STANDBY
- 质量分析
- 异常切换
- 启用Channel的质量分析功能(stat.enable=true 默认开启),在ChannelWrapper.call()时采集stat信息
- 异常切换
- 通过stat信息动态计算ChannelWrapper.priority(), 影响select结果
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.github.dzh</groupId>
<artifactId>dimit</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
<packaging>pom</packaging>

<properties>
Expand Down

0 comments on commit ff99777

Please sign in to comment.