content: /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you 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
   *
   *     http://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 org.apache.cassandra.index.accord;
  
  import java.util.Collections;
  import java.util.EnumMap;
  import java.util.Map;
  
  import accord.primitives.TxnId;
  
  public class Segment
  {
      public static final Segment EMPTY = new Segment(Collections.emptyMap());
  
      public final Map<Key, Metadata> groups;
  
      public Segment(Map<Key, Metadata> groups)
      {
          this.groups = groups;
      }
  
      public static class ComponentMetadata
      {
          public final long offset, endOffset;
  
          public ComponentMetadata(long offset, long endOffset)
          {
              this.offset = offset;
              this.endOffset = endOffset;
          }
      }
  
      public static class Metadata
      {
          public final EnumMap<IndexDescriptor.IndexComponent, ComponentMetadata> metas;
          public final byte[] minTerm, maxTerm;
          public final TxnId minTxnId;
          public final TxnId maxTxnId;
          public final TxnId maxRxId;
  
          public Metadata(EnumMap<IndexDescriptor.IndexComponent, ComponentMetadata> metas,
                          byte[] minTerm, byte[] maxTerm,
                          TxnId minTxnId, TxnId maxTxnId, TxnId maxRxId)
          {
              this.metas = metas;
              this.minTerm = minTerm;
              this.maxTerm = maxTerm;
              this.minTxnId = minTxnId;
              this.maxTxnId = maxTxnId;
              this.maxRxId = maxRxId;
          }
      }
  }
  