This repository has been archived by the owner on May 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: using "interceptor" to enhance the api(compress) (#126)
- Loading branch information
1 parent
5d60bd1
commit ed7d4c7
Showing
21 changed files
with
291 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/com/xiaomi/infra/pegasus/client/TableOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright (c) 2017, Xiaomi, Inc. All rights reserved. | ||
// This source code is licensed under the Apache License Version 2.0, which | ||
// can be found in the LICENSE file in the root directory of this source tree. | ||
package com.xiaomi.infra.pegasus.client; | ||
|
||
/** TableOptions is the internal options for opening a Pegasus table. */ | ||
public class TableOptions { | ||
private int backupRequestDelayMs; | ||
private boolean enableCompression; | ||
|
||
public TableOptions() { | ||
this.backupRequestDelayMs = 0; | ||
this.enableCompression = false; | ||
} | ||
|
||
public TableOptions withBackupRequestDelayMs(int backupRequestDelayMs) { | ||
this.backupRequestDelayMs = backupRequestDelayMs; | ||
return this; | ||
} | ||
|
||
public TableOptions withCompression(boolean enableCompression) { | ||
this.enableCompression = enableCompression; | ||
return this; | ||
} | ||
|
||
public int backupRequestDelayMs() { | ||
return this.backupRequestDelayMs; | ||
} | ||
|
||
public boolean enableBackupRequest() { | ||
return backupRequestDelayMs > 0; | ||
} | ||
|
||
public boolean enableCompression() { | ||
return enableCompression; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/com/xiaomi/infra/pegasus/rpc/InternalTableOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.xiaomi.infra.pegasus.rpc; | ||
|
||
import com.xiaomi.infra.pegasus.client.TableOptions; | ||
|
||
public class InternalTableOptions { | ||
private final KeyHasher keyHasher; | ||
private final TableOptions tableOptions; | ||
|
||
public InternalTableOptions(KeyHasher keyHasher, TableOptions tableOptions) { | ||
this.keyHasher = keyHasher; | ||
this.tableOptions = tableOptions; | ||
} | ||
|
||
public KeyHasher keyHasher() { | ||
return keyHasher; | ||
} | ||
|
||
public TableOptions tableOptions() { | ||
return tableOptions; | ||
} | ||
|
||
public static InternalTableOptions forTest() { | ||
return new InternalTableOptions(KeyHasher.DEFAULT, new TableOptions()); | ||
} | ||
} |
31 changes: 0 additions & 31 deletions
31
src/main/java/com/xiaomi/infra/pegasus/rpc/TableOptions.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.