Informar List/Watch

                                                                               +------------+
+------------+                          +------------+                 +------>| DeltaFIFO  |
| controller |                  +------>| Reflector  |                 |       +------------+-----------------+
+------------+-----------+      |       +------------+---------+       |       |   items map[string]Deltas    |
|  reflector *Reflector  |------+       |     store Store      |-------+       +------------------------------+
+------------------------+              +----------------------+        +------|        queue []string        |
|     config Config      |--+           |      List/Watch      |        |      +------------------------------+
+------------------------+  |           +----------------------+        |      | knownObjects KeyListerGetter |----|
|         ......         |  |           |        ......        |        |      +------------------------------+    |
+------------------------+  |           +----------------------+       (1)            |-----------------------------
       +--------------------+                                           |             |
       |                                                                |             v
       v                         +--process loop--------------------+   |      +------------+
+------------+                   |                                  |   |  --->|   cache    |
|   Config   |                   |         +--------------------+   |   |  |   +------------+----------------+
+------------+---------+         |    ---->|   (1) queue pop    | <-+---+  |   |cacheStorage ThreadSafeStore |--+
|        Queue         |         |    |    +----------+---------+   |      |   +-----------------------------+  |
+----------------------+         |    |               |             |      |   |           ......            |  |
|       Process        |-------->|    |               v             |(2)---|   +-----------------------------+  |
+----------------------+         |    |    +--------------------+   | |                                         |
|        ......        |         |    |    |  (2) update cache  |---+-+               +-------------------------+
+----------------------+         |    |    +----------+---------+   |                 |
                                 |    |               |             |                 v
                                 |    |               |             |          +-------------+
                                 |    |               v             |          |threadSafeMap|
                                 |    |    +--------------------+   |          +-------------+---------------+
                                 |    |----| (3) call callback  |   |          |items map[string]interface{} |
                                 |         +----------+---------+   |          +-----------------------------+
                                 +--------------------+-------------+          |      indexers Indexers      |
                                                      |                        +-----------------------------+
                                                      v                        |       indices Indices       |
                                 +----------------------------------+          +-----------------------------+
                                 |  OnAdd\OnUpdate\OnDelete         |          |           ......            |
                                 +----------------------------------+          +-----------------------------+
posted @ 2020-08-04 13:18  seamounts  阅读(126)  评论(0编辑  收藏  举报