001/*
002 * Logback: the reliable, generic, fast and flexible logging framework.
003 * Copyright (C) 1999-2026, QOS.ch. All rights reserved.
004 *
005 * This program and the accompanying materials are dual-licensed under
006 * either the terms of the Eclipse Public License v2.0 as published by
007 * the Eclipse Foundation
008 *
009 *   or (per the licensee's choosing)
010 *
011 * under the terms of the GNU Lesser General Public License version 2.1
012 * as published by the Free Software Foundation.
013 */
014package ch.qos.logback.classic.kryo;
015
016public class KryoClassicConstants {
017
018
019    public static final int DEFAULT_MAX_EVENTS_BEFORE_RESET = 8*1024;
020
021    /** Magic identifying a Kryo event stream. */
022    public static final byte[] STREAM_MAGIC = { 'S', 'T', 'W', 'D' };
023
024    /**
025     * Version 0: Vanilla, i.e. Kryo's default serializers. Event payloads are not framed.
026     */
027    public static final byte STREAM_VERSION_0 = 0;
028
029    /**
030     * Version 5: Custom uses {@link LoggingEventKryoVOSerializerV5} (presence bitmap,
031     * packed epoch-second/nanos delta, shared long-string serializer). Event payloads
032     * are framed ({@link StreamFrameV5}).
033     */
034    public static final byte STREAM_VERSION_5 = 5;
035
036
037    /** Size of the fixed stream header: magic (4) + version (1) + flags (1). */
038    public static final int STREAM_HEADER_SIZE = 6;
039
040    /** True when the body after the stream header uses framed EVENT/CLOSE records. */
041    public static boolean isFramed(byte streamVersion) {
042        return streamVersion == STREAM_VERSION_5;
043    }
044
045    /** Flag bit: Custom serializers (unset means Vanilla). */
046    public static final byte FLAG_CUSTOM_SERIALIZER = 0x01;
047
048}