func (eh *EventHistory) clone() *EventHistory {
	clonedQueue := eventQueue{
		Capacity: eh.Queue.Capacity,
		Events:   make([]*Event, eh.Queue.Capacity),
		Size:     eh.Queue.Size,
		Front:    eh.Queue.Front,
		Back:     eh.Queue.Back,
	}

	copy(clonedQueue.Events, eh.Queue.Events)
	return &EventHistory{
		StartIndex: eh.StartIndex,
		Queue:      clonedQueue,
		LastIndex:  eh.LastIndex,
	}

}
func (eh *EventHistory) clone() *EventHistory {
	clonedQueue := eventQueue{
		Capacity: eh.Queue.Capacity,
		Events:   make([]*Event, eh.Queue.Capacity),
		Size:     eh.Queue.Size,
		Front:    eh.Queue.Front,
		Back:     eh.Queue.Back,
	}

	copy(clonedQueue.Events, eh.Queue.Events)
	return &EventHistory{
		StartIndex: eh.StartIndex,
		Queue:      clonedQueue,
		LastIndex:  eh.LastIndex,
	}

}
func ( eh * EventHistory ) clone ( ) * EventHistory { clonedQueue := eventQueue { Capacity : eh . Queue . Capacity , Events : make ( [ ] * Event , eh . Queue . Capacity ) , Size : eh . Queue . Size , Front : eh . Queue . Front , Back : eh . Queue . Back , } copy ( clonedQueue . Events , eh . Queue . Events ) return & EventHistory { StartIndex : eh . StartIndex , Queue : clonedQueue , LastIndex : eh . LastIndex , } }
// clone will be protected by a stop-world lock
// do not need to obtain internal lock
clone will be protected by a stop - world lock do not need to obtain internal lock