Comparing version 1.1.1 to 1.2.0
@@ -5,2 +5,11 @@ # Changelog | ||
## [1.2.0](https://github.com/edvardchen/grpclb/compare/v1.1.1...v1.2.0) (2019-07-31) | ||
### Features | ||
* allow parseKV return undefined ([84ae325](https://github.com/edvardchen/grpclb/commit/84ae325)) | ||
### [1.1.1](https://github.com/edvardchen/grpclb/compare/v1.1.0...v1.1.1) (2019-07-31) | ||
@@ -7,0 +16,0 @@ |
@@ -13,3 +13,3 @@ import { Etcd3, Watcher, IOptions } from 'etcd3'; | ||
export interface KVParser { | ||
(key: string, value?: string): ServantNode; | ||
(key: string, value?: string): ServantNode | undefined; | ||
} | ||
@@ -27,3 +27,3 @@ export declare class EtcdResolver { | ||
onDel(key: string): void; | ||
parseEtcdKV(_key: string, value?: string): ServantNode; | ||
parseEtcdKV(_key: string, value?: string): ServantNode | undefined; | ||
getNodes(): Promise<Store>; | ||
@@ -30,0 +30,0 @@ /** next servant node */ |
@@ -52,3 +52,6 @@ "use strict"; | ||
onAdd(key, value) { | ||
const { service, address } = this.parseEtcdKV(key, value); | ||
const node = this.parseEtcdKV(key, value); | ||
if (!node) | ||
return; | ||
const { service, address } = node; | ||
this.store[service] = this.store[service] || { items: [], currIndex: 0 }; | ||
@@ -65,3 +68,6 @@ const { items } = this.store[service]; | ||
onDel(key) { | ||
const { address, service } = this.parseEtcdKV(key); | ||
const node = this.parseEtcdKV(key); | ||
if (!node) | ||
return; | ||
const { address, service } = node; | ||
this.store[service] && | ||
@@ -78,3 +84,6 @@ removeFromArray_1.default(this.store[service].items, item => item.address === address); | ||
const nodeSet = lodash_1.default.transform(nodes, (result, value, _key) => { | ||
const { service, address } = this.parseEtcdKV(_key, value); | ||
const node = this.parseEtcdKV(_key, value); | ||
if (!node) | ||
return; | ||
const { service, address } = node; | ||
result[service] = result[service] || { items: [], currIndex: 0 }; | ||
@@ -81,0 +90,0 @@ result[service].items.push({ service, address }); |
{ | ||
"name": "grpclb", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "grpc load balancer for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
Sorry, the diff of this file is not supported yet
25607
357