This repository has been archived by the owner on Feb 25, 2023. It is now read-only.
forked from twitter/pelikan
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Squashed 'deps/ccommon/' changes from 45b7bac..0094e2a
0094e2a add convenience array api (twitter#239) 6024ef7 add pipe config to rust ccommon-channel (twitter#247) eaf7f07 remove ccommon-time (twitter#248) git-subtree-dir: deps/ccommon git-subtree-split: 0094e2a99e4d535f8dec590e8474e6e4686bda07
- Loading branch information
Yao Yue
committed
Jul 14, 2020
1 parent
686fd02
commit e865600
Showing
8 changed files
with
107 additions
and
118 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 2020 Twitter, Inc. | ||
// Licensed under the Apache License, Version 2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
#[cfg(feature = "serde")] | ||
use serde::{Deserialize, Serialize}; | ||
|
||
// constants to define default values | ||
const PIPE_POOLSIZE: usize = 0; | ||
|
||
// helper functions | ||
fn poolsize() -> usize { | ||
PIPE_POOLSIZE | ||
} | ||
|
||
// definitions | ||
#[derive(Debug)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct PipeConfig { | ||
#[cfg_attr(feature = "serde", serde(default = "poolsize"))] | ||
poolsize: usize, | ||
} | ||
|
||
// implementation | ||
impl PipeConfig { | ||
pub fn poolsize(&self) -> usize { | ||
self.poolsize | ||
} | ||
} | ||
|
||
// trait implementations | ||
impl Default for PipeConfig { | ||
fn default() -> Self { | ||
Self { | ||
poolsize: poolsize(), | ||
} | ||
} | ||
} |
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,50 @@ | ||
// Copyright 2020 Twitter, Inc. | ||
// Licensed under the Apache License, Version 2.0 | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
#[cfg(feature = "serde")] | ||
use serde::{Deserialize, Serialize}; | ||
|
||
// constants to define default values | ||
const TCP_BACKLOG: usize = 128; | ||
const TCP_POOLSIZE: usize = 0; | ||
|
||
// helper functions | ||
fn backlog() -> usize { | ||
TCP_BACKLOG | ||
} | ||
|
||
fn poolsize() -> usize { | ||
TCP_POOLSIZE | ||
} | ||
|
||
// definitions | ||
#[derive(Debug)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct TcpConfig { | ||
#[cfg_attr(feature = "serde", serde(default = "backlog"))] | ||
backlog: usize, | ||
#[cfg_attr(feature = "serde", serde(default = "poolsize"))] | ||
poolsize: usize, | ||
} | ||
|
||
// implementation | ||
impl TcpConfig { | ||
pub fn backlog(&self) -> usize { | ||
self.backlog | ||
} | ||
|
||
pub fn poolsize(&self) -> usize { | ||
self.poolsize | ||
} | ||
} | ||
|
||
// trait implementations | ||
impl Default for TcpConfig { | ||
fn default() -> Self { | ||
Self { | ||
backlog: backlog(), | ||
poolsize: poolsize(), | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.