2 * Copyright 2017-present Open Networking Foundation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package io.atomix.storage.journal;
18 import static com.google.common.base.MoreObjects.toStringHelper;
21 * Indexed journal entry.
23 public class Indexed<E> {
24 private final long index;
25 private final E entry;
26 private final int size;
28 public Indexed(long index, E entry, int size) {
35 * Returns the entry index.
37 * @return The entry index.
44 * Returns the indexed entry.
46 * @return The indexed entry.
53 * Returns the serialized entry size.
55 * @return The serialized entry size.
62 * Returns the entry type class.
64 * @return The entry class.
66 public Class<?> type() {
67 return entry.getClass();
71 public String toString() {
72 return toStringHelper(this)