Interface LocalRpcService

All Known Implementing Classes:
AbstractLocalRpcService, LocalAppIdentityService, LocalBlobstoreService, LocalCapabilitiesService, LocalDatastoreV3Service, LocalImagesService, LocalLogService, LocalMailService, LocalMemcacheService, LocalModulesService, LocalSearchService, LocalTaskQueue, LocalURLFetchService, LocalUserService

public interface LocalRpcService
A local implementation of an RPC service. Services adheres to the following method convention:
 <Request extends ProtocolMessage, Response extends ProtocolMessage> 
 Response methodName(Status status, Request request)
 
For example,
 public class DatabaseService {
   public GetResponse get(Status status, GetRequest req) throws RpcException;
   public PutResponse put(Status status, PutRequest req) throws RpcException;
   // ...
 }
 
DevAppServer discovers LocalRpcServices implementations with ServiceLoader.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    The RPC status code.
  • Method Summary

    Modifier and Type
    Method
    Description
    getDefaultDeadline(boolean isOfflineRequest)
    Return the number of seconds that should be used as a deadline for each API call if no other deadline is requested by the user.
    Returns the maximum size of an encoded API request in bytes, or null for the default size.
    getMaximumDeadline(boolean isOfflineRequest)
    Return the maximum number of seconds that is allowed as a deadline for each API call.
    Returns the package for the service, for example, "datastore_v3".
    void
    init(LocalServiceContext context, Map<String,String> properties)
    Initializes the service with a set of configuration properties.
    void
    Puts a new service into "serving" mode.
    void
    Stops the service, releasing all of its resources.
  • Method Details

    • getPackage

      String getPackage()
      Returns the package for the service, for example, "datastore_v3".
      Returns:
      a not null package name.
    • init

      void init(LocalServiceContext context, Map<String,String> properties)
      Initializes the service with a set of configuration properties. Must be called before a service is started.
      Parameters:
      context - A context object for the application
      properties - A read-only Map of properties.
    • start

      void start()
      Puts a new service into "serving" mode. Aside from setting properties, the service is not functional until after having been started.
    • stop

      void stop()
      Stops the service, releasing all of its resources.
    • getDefaultDeadline

      Double getDefaultDeadline(boolean isOfflineRequest)
      Return the number of seconds that should be used as a deadline for each API call if no other deadline is requested by the user. This method may return null if the service has no opinion about the deadline, in which case a global deadline will be used instead.
    • getMaximumDeadline

      Double getMaximumDeadline(boolean isOfflineRequest)
      Return the maximum number of seconds that is allowed as a deadline for each API call. The user cannot request a deadline higher than this value. This method may return null if the service has no opinion about the maximum deadline, in which case a global maximum deadline will be used instead.
    • getMaxApiRequestSize

      Integer getMaxApiRequestSize()
      Returns the maximum size of an encoded API request in bytes, or null for the default size.