Skip to content

Commit

Permalink
docs: design new write protocol api (#141)
Browse files Browse the repository at this point in the history
Signed-off-by: Young Xu <[email protected]>
  • Loading branch information
xuthus5 authored Dec 18, 2024
1 parent 5076c72 commit 42bda33
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/guide/develop/client_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ classDiagram
+ enum compressMethod // gzip, zstd, br
+ TlsConfig tlsConfig // nullable, language specific
+ void close()
+ GRPCConfig grpcConfig // if null, call WriteByGRPC will nothing to do, otherwise send write request by gRPC
}
class Address {
Expand All @@ -48,6 +49,15 @@ classDiagram
+ Duration batchInterval // must be greater than 0
+ int batchSize // must be greater than 0, if set too large, may cause client overflow or server-side rejected the request.
}
class GRPCConfig {
+ List~Address~ addresses
+ AuthConfig authConfig
+ BatchConfig batchConfig
+ enum compressMethod // gzip, zstd, br
+ TlsConfig tlsConfig
+ timeout
}
OpenGeminiClient "1" *-- "many" Address: contains
OpenGeminiClient *-- AuthConfig: contains
Expand Down Expand Up @@ -148,6 +158,7 @@ classDiagram
+ WritePointWithRp(String database, String rp, Point point)
+ WriteBatchPoints(String database, BatchPoints batchPoints)
+ WriteBatchPointsWithRp(String database, String rp, BatchPoints batchPoints)
+ WriteByGRPC(req WriteRequest) // WriteRequest build from RecordBuilder
}
class BatchPoints {
+ List~Point~ points
Expand All @@ -169,6 +180,20 @@ classDiagram
+ SetPrecision(type)
+ SetMeasurement(name)
}
class RecordBuilder { // new from NewRecordBuilder with database and retention policy params
+ RecordBuilder Authenticate(String username, String password)
+ RecordBuilder AddRecord(RecordLine line) // RecordLine build from RecordLineBuilder
+ WriteRequest Build()
}
class RecordLineBuilder { // new from NewRecordLineBuilder with measurement param
+ RecordLineBuilder AddTag(String key, String value)
+ RecordLineBuilder AddTags(map[String]String)
+ RecordLineBuilder AddField(String key, Any value)
+ RecordLineBuilder AddFields(map[String]Any)
+ RecordLine Build(Time time)
}
BatchPoints "1" *-- "many" Point: contains
```
Expand Down
25 changes: 25 additions & 0 deletions src/zh/guide/develop/client_design.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ classDiagram
+ enum compressMethod // gzip, zstd, br
+ TlsConfig tlsConfig // nullable, language specific
+ void close()
+ GRPCConfig grpcConfig // if null, call WriteByGRPC will nothing to do, otherwise send write request by gRPC
}
class Address {
Expand All @@ -50,6 +51,15 @@ classDiagram
+ int batchSize // must be greater than 0
}
class GRPCConfig {
+ List~Address~ addresses
+ AuthConfig authConfig
+ BatchConfig batchConfig
+ enum compressMethod // gzip, zstd, br
+ TlsConfig tlsConfig
+ timeout
}
OpenGeminiClient "1" *-- "many" Address: contains
OpenGeminiClient *-- AuthConfig: contains
OpenGeminiClient *-- BatchConfig: contains
Expand Down Expand Up @@ -149,6 +159,7 @@ classDiagram
+ WritePointWithRp(String database, String rp, Point point)
+ WriteBatchPoints(String database, BatchPoints batchPoints)
+ WriteBatchPointsWithRp(String database, String rp, BatchPoints batchPoints)
+ WriteByGRPC(req WriteRequest) // WriteRequest build from RecordBuilder
}
class BatchPoints {
+ List~Point~ points
Expand All @@ -171,6 +182,20 @@ classDiagram
+ SetMeasurement(name)
}
class RecordBuilder { // new from NewRecordBuilder with database and retention policy params
+ RecordBuilder Authenticate(String username, String password)
+ RecordBuilder AddRecord(RecordLine line) // RecordLine build from RecordLineBuilder
+ WriteRequest Build()
}
class RecordLineBuilder { // new from NewRecordLineBuilder with measurement param
+ RecordLineBuilder AddTag(String key, String value)
+ RecordLineBuilder AddTags(map[String]String)
+ RecordLineBuilder AddField(String key, Any value)
+ RecordLineBuilder AddFields(map[String]Any)
+ RecordLine Build(Time time)
}
BatchPoints "1" *-- "many" Point: contains
```

Expand Down

0 comments on commit 42bda33

Please sign in to comment.