content: /*
   * Copyright 2014-2025 Real Logic Limited.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   * https://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package io.aeron;
  
  import org.agrona.DirectBuffer;
  import org.agrona.concurrent.status.AtomicCounter;
  
  /**
   * Functional interface that abstracts creation of the counters.
   */
  @FunctionalInterface
  public interface CounterProvider
  {
      /**
       * Allocate a counter record and wrap it with a new {@link AtomicCounter} for use.
       * <p>
       * If the keyBuffer is null then a copy of the key is not attempted.
       *
       * @param typeId      for the counter.
       * @param keyBuffer   containing the optional key for the counter.
       * @param keyOffset   within the keyBuffer at which the key begins.
       * @param keyLength   of the key in the keyBuffer.
       * @param labelBuffer containing the mandatory label for the counter.
       * @param labelOffset within the labelBuffer at which the label begins.
       * @param labelLength of the label in the labelBuffer.
       * @return the counter object.
       */
      AtomicCounter newCounter(
          int typeId,
          DirectBuffer keyBuffer,
          int keyOffset,
          int keyLength,
          DirectBuffer labelBuffer,
          int labelOffset,
          int labelLength);
  }
  