本文整理汇总了TypeScript中src/util/fixLong.FixLong函数的典型用法代码示例。如果您正苦于以下问题:TypeScript FixLong函数的具体用法?TypeScript FixLong怎么用?TypeScript FixLong使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FixLong函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: addStatementStats
export function addStatementStats(a: StatementStatistics, b: StatementStatistics) {
const countA = FixLong(a.count).toInt();
const countB = FixLong(b.count).toInt();
return {
count: a.count.add(b.count),
first_attempt_count: a.first_attempt_count.add(b.first_attempt_count),
max_retries: a.max_retries.greaterThan(b.max_retries) ? a.max_retries : b.max_retries,
num_rows: addNumericStats(a.num_rows, b.num_rows, countA, countB),
parse_lat: addNumericStats(a.parse_lat, b.parse_lat, countA, countB),
plan_lat: addNumericStats(a.plan_lat, b.plan_lat, countA, countB),
run_lat: addNumericStats(a.run_lat, b.run_lat, countA, countB),
service_lat: addNumericStats(a.service_lat, b.service_lat, countA, countB),
overhead_lat: addNumericStats(a.overhead_lat, b.overhead_lat, countA, countB),
};
}
示例2: IsLeader
export function IsLeader(info: protos.cockroach.server.serverpb.RangeInfo$Properties) {
const localRep = GetLocalReplica(info);
if (_.isNil(localRep)) {
return false;
}
return Long.fromInt(localRep.replica_id).eq(FixLong(info.raft_state.lead));
}
示例3: getRangeLog
export function getRangeLog(
req: RangeLogRequestMessage,
timeout?: moment.Duration,
): Promise<RangeLogResponseMessage> {
const rangeID = FixLong(req.range_id);
const rangeIDQuery = (rangeID.eq(0)) ? "" : `/${rangeID.toString()}`;
const limit = (!_.isNil(req.limit)) ? `?limit=${req.limit}` : "";
return timeoutFetch(
serverpb.RangeLogResponse,
`${API_PREFIX}/rangelog${rangeIDQuery}${limit}`,
null,
timeout,
);
}
示例4: IsLeaseEpoch
export function IsLeaseEpoch(lease: protos.cockroach.roachpb.ILease) {
return !FixLong(lease.epoch).eq(0);
}
示例5: stdDevLong
export function stdDevLong(stat: NumericStat, count: number | Long) {
return stdDev(stat, FixLong(count).toInt());
}