wuchong commented on a change in pull request #8341: [FLINK-11633][docs-zh] 
Translate "Working with state" into Chinese
URL: https://github.com/apache/flink/pull/8341#discussion_r281010291
 
 

 ##########
 File path: docs/dev/stream/state/state.zh.md
 ##########
 @@ -524,46 +443,32 @@ val counts: DataStream[(String, Int)] = stream
     })
 {% endhighlight %}
 
-## Using Managed Operator State
+## 使用 Managed Operator State
 
-To use managed operator state, a stateful function can implement either the 
more general `CheckpointedFunction`
-interface, or the `ListCheckpointed<T extends Serializable>` interface.
+用户可以通过实现 `CheckpointedFunction` 或 `ListCheckpointed<T extends Serializable>` 
接口来使用 managed operator state。
 
 #### CheckpointedFunction
 
-The `CheckpointedFunction` interface provides access to non-keyed state with 
different
-redistribution schemes. It requires the implementation of two methods:
+`CheckpointedFunction` 接口提供了访问 non-keyed state 的方法,需要实现如下两个方法:
 
 {% highlight java %}
 void snapshotState(FunctionSnapshotContext context) throws Exception;
 
 void initializeState(FunctionInitializationContext context) throws Exception;
 {% endhighlight %}
 
-Whenever a checkpoint has to be performed, `snapshotState()` is called. The 
counterpart, `initializeState()`,
-is called every time the user-defined function is initialized, be that when 
the function is first initialized
-or be that when the function is actually recovering from an earlier 
checkpoint. Given this, `initializeState()` is not
-only the place where different types of state are initialized, but also where 
state recovery logic is included.
+进行 checkpoint 时会调用 `snapshotState()`。 用户自定义函数初始化时会调用 
`initializeState()`,初始化包括第一次自定义函数初始化和从之前的 checkpoint 恢复。
+因此 `initializeState()` 不仅是定义不同状态类型初始化的地方,也需要包括状态恢复的逻辑。
 
-Currently, list-style managed operator state is supported. The state
-is expected to be a `List` of *serializable* objects, independent from each 
other,
-thus eligible for redistribution upon rescaling. In other words, these objects 
are the finest granularity at which
-non-keyed state can be redistributed. Depending on the state accessing method,
-the following redistribution schemes are defined:
+当前,managed operator state 已 list 的形式存在。这些状态是一个 *可序列* 
对象的集合,彼此独立,方便在改变并发后进行状态的重新分派。
 
 Review comment:
   ```suggestion
   当前,managed operator state 以 list 的形式存在。这些状态是一个 *可序列化* 对象的集合 
`List`,彼此独立,方便在改变并发后进行状态的重新分派。
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to