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/job.proto";
import "proto/journal/policy.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.
//

/**
 * Unique operation id.
 */
message JournalOpPId {
    optional int64 mostSignificantBits = 1;
    optional int64 leastSignificantBits = 2;
}

// next available id: 56
message JournalEntry {
  // shared fields.
  optional int64 sequence_number = 1;
  optional JournalOpPId operationId = 52;
  // action fields.
  optional ActiveSyncTxIdEntry active_sync_tx_id = 34;
  optional AddSyncPointEntry add_sync_point = 32;
  optional AddMountPointEntry add_mount_point = 2;
  optional AsyncPersistRequestEntry async_persist_request = 16;
  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 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 RemoveSyncPointEntry remove_sync_point = 33;
  optional RenameEntry rename = 19;
  optional SetAclEntry set_acl = 31;
  optional SetAttributeEntry set_attribute = 27;
  optional UpdateUfsModeEntry update_ufs_mode = 30;
  optional UpdateInodeEntry update_inode = 35;
  optional UpdateInodeDirectoryEntry update_inode_directory = 36;
  optional UpdateInodeFileEntry update_inode_file = 37;
  optional LoadJobEntry load_job = 53;
  optional CopyJobEntry copy_job = 54;
  optional MoveJobEntry move_job = 55;
  optional PolicyDefinitionEntry policy_definition = 56;
  optional PolicyRemoveEntry policy_remove = 57;

  // 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;
}
