You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.3 KiB

  1. // Copyright (c) 2018 Couchbase, Inc.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. package scorch
  15. import "time"
  16. // RegistryAsyncErrorCallbacks should be treated as read-only after
  17. // process init()'ialization.
  18. var RegistryAsyncErrorCallbacks = map[string]func(error){}
  19. // RegistryEventCallbacks should be treated as read-only after
  20. // process init()'ialization.
  21. var RegistryEventCallbacks = map[string]func(Event){}
  22. // Event represents the information provided in an OnEvent() callback.
  23. type Event struct {
  24. Kind EventKind
  25. Scorch *Scorch
  26. Duration time.Duration
  27. }
  28. // EventKind represents an event code for OnEvent() callbacks.
  29. type EventKind int
  30. // EventKindCloseStart is fired when a Scorch.Close() has begun.
  31. var EventKindCloseStart = EventKind(1)
  32. // EventKindClose is fired when a scorch index has been fully closed.
  33. var EventKindClose = EventKind(2)
  34. // EventKindMergerProgress is fired when the merger has completed a
  35. // round of merge processing.
  36. var EventKindMergerProgress = EventKind(3)
  37. // EventKindPersisterProgress is fired when the persister has completed
  38. // a round of persistence processing.
  39. var EventKindPersisterProgress = EventKind(4)
  40. // EventKindBatchIntroductionStart is fired when Batch() is invoked which
  41. // introduces a new segment.
  42. var EventKindBatchIntroductionStart = EventKind(5)
  43. // EventKindBatchIntroduction is fired when Batch() completes.
  44. var EventKindBatchIntroduction = EventKind(6)
  45. // EventKindMergeTaskIntroductionStart is fired when the merger is about to
  46. // start the introduction of merged segment from a single merge task.
  47. var EventKindMergeTaskIntroductionStart = EventKind(7)
  48. // EventKindMergeTaskIntroduction is fired when the merger has completed
  49. // the introduction of merged segment from a single merge task.
  50. var EventKindMergeTaskIntroduction = EventKind(8)