HBASE-24611 : Bring back old constructor of SnapshotDescription as deprecated (#1944)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Viraj Jasani 2020-06-22 12:04:20 +05:30 committed by GitHub
parent 8f1353b447
commit 2b5ea44978
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/**
/*
* 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
@ -19,6 +19,7 @@ package org.apache.hadoop.hbase.client;
import java.util.Map;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.hadoop.hbase.TableName;
import org.apache.yetus.audience.InterfaceAudience;
@ -38,7 +39,7 @@ public class SnapshotDescription {
private final int version;
public SnapshotDescription(String name) {
this(name, (TableName)null);
this(name, null);
}
public SnapshotDescription(String name, TableName table) {
@ -53,6 +54,24 @@ public class SnapshotDescription {
this(name, table, type, owner, -1, -1, null);
}
/**
* SnapshotDescription Parameterized Constructor
*
* @param name Name of the snapshot
* @param table TableName associated with the snapshot
* @param type Type of the snapshot - enum SnapshotType
* @param owner Snapshot Owner
* @param creationTime Creation time for Snapshot
* @param version Snapshot Version
* @deprecated since 2.3.0 and will be removed in 4.0.0. Use
* {@link #SnapshotDescription(String, TableName, SnapshotType, String, long, int, Map)}
*/
@Deprecated
public SnapshotDescription(String name, TableName table, SnapshotType type, String owner,
long creationTime, int version) {
this(name, table, type, owner, creationTime, version, null);
}
/**
* SnapshotDescription Parameterized Constructor
*
@ -65,7 +84,7 @@ public class SnapshotDescription {
* @param snapshotProps Additional properties for snapshot e.g. TTL
*/
public SnapshotDescription(String name, TableName table, SnapshotType type, String owner,
long creationTime, int version, Map<String, Object> snapshotProps) {
long creationTime, int version, Map<String, Object> snapshotProps) {
this.name = name;
this.table = table;
this.snapShotType = type;
@ -127,16 +146,14 @@ public class SnapshotDescription {
@Override
public String toString() {
return new StringBuilder("SnapshotDescription: ")
.append("name = ")
.append(name)
.append("/table = ")
.append(table)
.append(" /owner = ")
.append(owner)
.append(creationTime != -1 ? ("/creationtime = " + creationTime) : "")
.append(ttl != -1 ? ("/ttl = " + ttl) : "")
.append(version != -1 ? ("/version = " + version) : "")
.toString();
return new ToStringBuilder(this)
.append("name", name)
.append("table", table)
.append("snapShotType", snapShotType)
.append("owner", owner)
.append("creationTime", creationTime)
.append("ttl", ttl)
.append("version", version)
.toString();
}
}