type EventHistory … func newEventHistory(capacity int) *EventHistory { … } // addEvent function adds event into the eventHistory func (eh *EventHistory) addEvent(e *Event) *Event { … } // scan enumerates events from the index history and stops at the first point // where the key matches. func (eh *EventHistory) scan(key string, recursive bool, index uint64) (*Event, *v2error.Error) { … } // clone will be protected by a stop-world lock // do not need to obtain internal lock func (eh *EventHistory) clone() *EventHistory { … }