rocketmq-client-nodejs
Version:
RocketMQ Node.js Client
44 lines (43 loc) • 2.05 kB
TypeScript
/**
* 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 regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Duration } from 'google-protobuf/google/protobuf/duration_pb';
import { Resource } from '../../proto/apache/rocketmq/v2/definition_pb';
export declare const MASTER_BROKER_ID = 0;
export declare function getTimestamp(): {
seconds: number;
nanos: number;
timestamp: number;
};
export declare function getRequestDateTime(): string;
export declare function sign(accessSecret: string, dateTime: string): string;
export declare function createDuration(ms: number): Duration;
export declare function createResource(name: string): Resource;
export declare function crc32CheckSum(bytes: Buffer): string;
export declare function md5CheckSum(bytes: Uint8Array): string;
export declare function sha1CheckSum(bytes: Uint8Array): string;
/**
* Java: Hashing.sipHash24().hashBytes(messageGroup.getBytes(StandardCharsets.UTF_8)).asLong()
*/
export declare function calculateStringSipHash24(value: string): bigint;
/**
* Calculate hash code for a string (Java String.hashCode() compatible).
* This is used for implementing equals/hashCode contract in TypeScript classes.
*
* @param str - The string to calculate hash code for
* @return Hash code as a 32-bit integer
*/
export declare function hashCodeOfString(str: string): number;