-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(s3stream): policies of allocating memory (#938)
* feat(s3stream): policies of allocating memory Signed-off-by: Ning Yu <[email protected]> * feat(config): add config `s3.stream.allocator.policy` Signed-off-by: Ning Yu <[email protected]> * feat(config): add "s3.stream.allocator.policy" Signed-off-by: Ning Yu <[email protected]> --------- Signed-off-by: Ning Yu <[email protected]>
- Loading branch information
1 parent
0540f83
commit 699dae7
Showing
12 changed files
with
134 additions
and
17 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
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
53 changes: 53 additions & 0 deletions
53
s3stream/src/main/java/com/automq/stream/s3/ByteBufAllocPolicy.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,53 @@ | ||
/* | ||
* Copyright 2024, AutoMQ CO.,LTD. | ||
* | ||
* Use of this software is governed by the Business Source License | ||
* included in the file BSL.md | ||
* | ||
* As of the Change Date specified in that file, in accordance with | ||
* the Business Source License, use of this software will be governed | ||
* by the Apache License, Version 2.0 | ||
*/ | ||
|
||
package com.automq.stream.s3; | ||
|
||
public enum ByteBufAllocPolicy { | ||
|
||
/** | ||
* Allocate memory from the heap without pooling. | ||
*/ | ||
UNPOOLED_HEAP(false, false), | ||
|
||
/** | ||
* Allocate memory from the heap with pooling. | ||
*/ | ||
POOLED_HEAP(true, false), | ||
|
||
/** | ||
* Use pooled direct memory. | ||
*/ | ||
POOLED_DIRECT(true, true); | ||
|
||
/** | ||
* Whether the buffer should be pooled or not. | ||
*/ | ||
private final boolean pooled; | ||
|
||
/** | ||
* Whether the buffer should be direct or not. | ||
*/ | ||
private final boolean direct; | ||
|
||
ByteBufAllocPolicy(boolean pooled, boolean direct) { | ||
this.pooled = pooled; | ||
this.direct = direct; | ||
} | ||
|
||
public boolean isPooled() { | ||
return pooled; | ||
} | ||
|
||
public boolean isDirect() { | ||
return direct; | ||
} | ||
} |
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