orchard/internal/controller
Fedor Korotkov f6b48b7c42
Change event prefix to preserve order under load (#89)
* Change event prefix to preserve order under load

When there are a lot of events streamed from a worker, it's possible to have two batches coming for the same timestamp (which is a timestamp of the event on the worker). This way the existing logic would mess up the order because `index` and the random number doesn't guarantee the order.

To fix this I've changed the format of the prefix for the event to include tro things:

1. Timestamp in nanoseconds of the injection time on the controller so two sequential batches will have guaranteed order unless they are processed within a nanosecond.
2. Made the `index` being fixed length with trailing zeros, so they are properly lexicographically sorted (`000001`, `000002`, ...).

* No need to disable linting
2023-06-05 17:01:12 +00:00
..
notifier Remove UID for now and use machine ID to differentiate workers (#48) 2023-03-23 23:38:54 +04:00
proxy Refactorings for simplify readability (#35) 2023-03-17 06:11:28 -04:00
scheduler Implement restart policy for VMs (#83) 2023-04-24 19:30:08 +04:00
store Change event prefix to preserve order under load (#89) 2023-06-05 17:01:12 +00:00
api.go Add basic Prometheus metrics (#82) 2023-04-21 10:05:01 +04:00
api_controller.go Controller info endpoint and API integration examples (#75) 2023-04-11 07:28:46 +00:00
api_service_accounts.go REST API: provide error messages in error responses (#66) 2023-03-27 14:12:03 -04:00
api_test.go REST API: provide error messages in error responses (#66) 2023-03-27 14:12:03 -04:00
api_vms.go Implement restart policy for VMs (#83) 2023-04-24 19:30:08 +04:00
api_vms_portforward.go Make port-forward endpoint to wait for the VM (#65) 2023-03-27 23:52:21 +04:00
api_workers.go Remove worker role (#77) 2023-04-12 12:03:24 +04:00
controller.go Fail VMs if the worker had crashed/is unhealthy (#70) 2023-04-03 16:47:49 +04:00
datadir.go Consolidate controller bootstrap login in `run` command (#38) 2023-03-21 15:36:55 -04:00
errorresponse.go REST API: provide error messages in error responses (#66) 2023-03-27 14:12:03 -04:00
option.go Fail VMs if the worker had crashed/is unhealthy (#70) 2023-04-03 16:47:49 +04:00
rpc.go Remove worker role (#77) 2023-04-12 12:03:24 +04:00