syntax = "proto2";

package alluxio.proto.journal;
option java_package = "alluxio.proto.journal";

import "proto/journal/block.proto";
import "proto/journal/file.proto";
import "proto/journal/meta.proto";
import "proto/journal/table.proto";

// Wraps around all types of Alluxio journal entries.
//
// NOTE: Exactly one of the *Entry entries is expected to be set. Ideally we would use the 'oneof'
// protobuf syntax to enforce this. However, 'oneof' is only available since protobuf version
// 2.6.0 and adding this depedency would conflict with the version of protobuf used by Hadoop 2.x
// and Spark. We use protobuf version 2.5.0 instead, which is compatible with Hadoop and Spark.
//

// next available id: 51
message JournalEntry {
  optional int64 sequence_number = 1;
  optional ActiveSyncTxIdEntry active_sync_tx_id = 34;
  optional AddTableEntry add_table = 43;
  optional AddSyncPointEntry add_sync_point = 32;
  optional AddMountPointEntry add_mount_point = 2;
  optional AsyncPersistRequestEntry async_persist_request = 16;
  optional AttachDbEntry attach_db = 44;
  optional BlockContainerIdGeneratorEntry block_container_id_generator = 3;
  optional BlockInfoEntry block_info = 4;
  optional ClusterInfoEntry cluster_info = 42;
  optional CompleteFileEntry complete_file = 5;
  optional DeleteBlockEntry delete_block = 29;
  optional DeleteFileEntry delete_file = 6;
  optional DeleteMountPointEntry delete_mount_point = 8;
  optional DetachDbEntry detach_db = 45;
  optional InodeDirectoryEntry inode_directory = 9;
  optional InodeDirectoryIdGeneratorEntry inode_directory_id_generator = 10;
  optional InodeFileEntry inode_file = 11;
  optional InodeLastModificationTimeEntry inode_last_modification_time = 12;
  optional NewBlockEntry new_block = 38;
  optional PathPropertiesEntry path_properties = 40;
  optional PersistDirectoryEntry persist_directory = 15;
  optional RemovePathPropertiesEntry remove_path_properties = 41;
  optional RemoveTableEntry remove_table = 50;
  optional RemoveTransformJobInfoEntry remove_transform_job_info = 47;
  optional RemoveSyncPointEntry remove_sync_point = 33;
  optional RenameEntry rename = 19;
  optional SetAclEntry set_acl = 31;
  optional SetAttributeEntry set_attribute = 27;
  optional AddTransformJobInfoEntry add_transform_job_info = 46;
  optional CompleteTransformTableEntry complete_transform_table = 48;
  optional UpdateDatabaseInfoEntry update_database_info = 49;
  optional UpdateUfsModeEntry update_ufs_mode = 30;
  optional UpdateInodeEntry update_inode = 35;
  optional UpdateInodeDirectoryEntry update_inode_directory = 36;
  optional UpdateInodeFileEntry update_inode_file = 37;

  // This journal entry is a list of other entries. when a journal entry
  // contains other journal entries, all other optional fields must be unset.
  repeated JournalEntry journal_entries = 39;
}
