How to use the google-gax.createByteLengthFunction function in google-gax

To help you get started, we’ve selected a few google-gax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googleapis / nodejs-pubsub / src / v1 / publisher_client.js View on Github external
'subscriptions'
      ),
    };

    const protoFilesRoot = opts.fallback
      ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json'))
      : gaxModule.protobuf.loadSync(nodejsProtoPath);

    // Some methods on this API support automatically batching
    // requests; denote this.
    this._descriptors.batching = {
      publish: new gaxModule.BundleDescriptor(
        'messages',
        ['topic'],
        'messageIds',
        gax.createByteLengthFunction(
          protoFilesRoot.lookup('google.pubsub.v1.PubsubMessage')
        )
      ),
    };

    // Put together the default options sent with requests.
    const defaults = gaxGrpc.constructSettings(
      'google.pubsub.v1.Publisher',
      gapicConfig,
      opts.clientConfig,
      {'x-goog-api-client': clientHeader.join(' ')}
    );

    // Set up a dictionary of "inner API calls"; the core implementation
    // of calling the API is handled in `google-gax`, with this code
    // merely providing the destination and request information.
github googleapis / nodejs-logging / src / v2 / logging_service_v2_client.js View on Github external
'..',
        '..',
        'protos',
        'google/logging/v2/logging.proto'
      ),
      protoFilesRoot
    );

    // Some methods on this API support automatically batching
    // requests; denote this.
    this._descriptors.batching = {
      writeLogEntries: new gax.BundleDescriptor(
        'entries',
        ['logName', 'resource', 'labels'],
        null,
        gax.createByteLengthFunction(
          protoFilesRoot.lookup('google.logging.v2.LogEntry')
        )
      ),
    };

    // Put together the default options sent with requests.
    var defaults = gaxGrpc.constructSettings(
      'google.logging.v2.LoggingServiceV2',
      gapicConfig,
      opts.clientConfig,
      {'x-goog-api-client': clientHeader.join(' ')}
    );

    // Set up a dictionary of "inner API calls"; the core implementation
    // of calling the API is handled in `google-gax`, with this code
    // merely providing the destination and request information.
github googleapis / nodejs-logging / src / v2 / logging_service_v2_client.js View on Github external
'logNames'
      ),
    };

    const protoFilesRoot = opts.fallback
      ? gaxModule.protobuf.Root.fromJSON(require('../../protos/protos.json'))
      : gaxModule.protobuf.loadSync(nodejsProtoPath);

    // Some methods on this API support automatically batching
    // requests; denote this.
    this._descriptors.batching = {
      writeLogEntries: new gaxModule.BundleDescriptor(
        'entries',
        ['logName', 'resource', 'labels'],
        null,
        gax.createByteLengthFunction(
          protoFilesRoot.lookup('google.logging.v2.LogEntry')
        )
      ),
    };

    // Put together the default options sent with requests.
    const defaults = gaxGrpc.constructSettings(
      'google.logging.v2.LoggingServiceV2',
      gapicConfig,
      opts.clientConfig,
      {'x-goog-api-client': clientHeader.join(' ')}
    );

    // Set up a dictionary of "inner API calls"; the core implementation
    // of calling the API is handled in `google-gax`, with this code
    // merely providing the destination and request information.