// Snapshot saves the current state of the pool. func (r *PortAllocator) Snapshot(dst *api.RangeAllocation) error { snapshottable, ok := r.alloc.(allocator.Snapshottable) if !ok { return fmt.Errorf("not a snapshottable allocator") } rangeString, data := snapshottable.Snapshot() dst.Range = rangeString dst.Data = data return nil }