/*
 * 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.
 */
option java_package = "org.apache.flume.channel.file.proto";
option java_outer_classname = "ProtosFactory";

message Checkpoint {
  required sfixed32 version = 1;
  required sfixed64 writeOrderID = 2;
  required sfixed32 queueSize = 3;
  required sfixed32 queueHead = 4;
  repeated ActiveLog activeLogs = 5;
}

message ActiveLog {
  required sfixed32 logFileID = 1;
  required sfixed32 count = 2;
}

message LogFileMetaData {
  required sfixed32 version = 1;
  required sfixed32 logFileID = 2;
  required sfixed64 checkpointPosition = 3;
  required sfixed64 checkpointWriteOrderID = 4;
  optional LogFileEncryption encryption = 5;
  optional sfixed64 backupCheckpointPosition = 6;
  optional sfixed64 backupCheckpointWriteOrderID = 7;
}

message LogFileEncryption {
  required string cipherProvider = 1;
  required string keyAlias = 2;
  optional bytes parameters = 3;
}

message TransactionEventHeader {
  required sfixed32 type = 1;
  required sfixed64 transactionID = 2;
  required sfixed64 writeOrderID = 3;
}

message Put {
  required FlumeEvent event = 1;
  optional sfixed64 checksum = 2;
}

message Take {
  required sfixed32 fileID = 1;
  required sfixed32 offset = 2;
}

message Rollback {

}

message Commit {
  required sfixed32 type = 1;
}

message TransactionEventFooter {

}

message FlumeEvent {
  repeated FlumeEventHeader headers = 1;
  required bytes body = 2;
}

message FlumeEventHeader {
  required string key = 1;
  required string value = 2;
}
