Interface Control


  • public interface Control
    Encapsulates all administrative functions of PGX
    • Method Detail

      • getVersion

        PgxFuture<java.lang.String> getVersion()
      • getExtendedVersion

        PgxFuture<oracle.pgx.common.VersionInfo> getExtendedVersion()
        Gets an extended version.
        Returns:
        VersionInfo object
      • getPgxConfig

        PgxFuture<java.util.Map<PgxConfig.Field,​java.lang.Object>> getPgxConfig()
        Gets the pgx config.
        Returns:
        current PGX server configuration as JSON string
      • getPgxConfigObject

        default PgxFuture<PgxConfig> getPgxConfigObject()
        Gets the pgx config as PgxConfig object
        Returns:
        current PGX server configuration
      • start

        PgxFuture<java.lang.Void> start​(java.io.InputStream config)
      • start

        PgxFuture<java.lang.Void> start​(java.lang.String json)
      • start

        PgxFuture<java.lang.Void> start​(java.lang.String json,
                                        java.lang.String keystorePath,
                                        char[] keystorePassword)
      • isRunning

        PgxFuture<java.lang.Boolean> isRunning()
        Check if the engine is currently up
        Returns:
        true if engine is currently running and using less than RUNNING_MEMORY_USAGE_RATIO, false otherwise
      • isReady

        PgxFuture<java.lang.Boolean> isReady()
        Check if the engine is ready to accept new requests
        Returns:
        true if engine is using less than READINESS_MEMORY_USAGE_RATIO , false otherwise
      • isGraphPreloadingDone

        PgxFuture<java.lang.Boolean> isGraphPreloadingDone()
        Check if the preloading of the graphs is finished
        Returns:
        true if the graph preloading is done, false otherwise
      • shutdownNowIfRunning

        PgxFuture<java.lang.Void> shutdownNowIfRunning()
      • shutdown

        PgxFuture<java.lang.Boolean> shutdown​(long timeout,
                                              java.util.concurrent.TimeUnit unit)
        gracefully shuts down the engine and cleans up resources. All currently enqueued tasks will be worked off prior shut down, new incoming requests get rejected. This call blocks until shut down is complete or timed out.
        Returns:
        true if gracefully shut down. false if timed out before shut down.
      • shutdownNow

        PgxFuture<java.lang.Void> shutdownNow()
        forces the engine to stop and clean up resources. Currently running tasks are interrupted. New incoming requests get rejected.

        Throws an exception when current tasks didn't finish after a short grace period.
      • freeCachedMemory

        PgxFuture<oracle.pgx.common.pojo.admin.CacheStatistics> freeCachedMemory()
        Trigger memory cleanup to free unused graphs if RELEASE_MEMORY_THRESHOLD is reached
      • freeCachedMemory

        PgxFuture<oracle.pgx.common.pojo.admin.CacheStatistics> freeCachedMemory​(double threshold)
        Trigger memory cleanup to free unused graphs if threshold is reached
      • unpinGraph

        PgxFuture<java.lang.Void> unpinGraph​(java.lang.String graphName)
        Unpins the specified published graph so that if no session uses any of its snapshot, it can be removed.
        Parameters:
        graphName - name of the published graph to unpin
      • getServerState

        @BetaApi
        PgxFuture<com.fasterxml.jackson.databind.JsonNode> getServerState()
        Gets the server state.
        Returns:
        server inspection information
        Since:
        2.7.0
      • killSession

        PgxFuture<java.lang.Void> killSession​(java.lang.String sessionId)
        Kill session.
        Parameters:
        sessionId - the session to be killed
      • setSessionIdleTimeout

        PgxFuture<java.lang.Void> setSessionIdleTimeout​(java.lang.String sessionId,
                                                        long idleTimeout,
                                                        java.util.concurrent.TimeUnit unit)
        updates the session with idle timeout
        Parameters:
        sessionId - the session to be mutated
        idleTimeout - if not negative, tries to overwrite session idle timeout
        unit - time unit of idleTimeout
      • addUserData

        void addUserData​(java.lang.String sessionId,
                         java.lang.String key,
                         java.lang.Object data)
        add session-private user data to a session. The data gets freed once the session dies. The data can later be retrieved by the given key using getUserData(SessionContext, String). If data with the same key already exists, it will be overwritten.

        This method is thread safe.

        Parameters:
        sessionId - the ID of the target session
        key -
        data -
        Throws:
        java.util.concurrent.RejectedExecutionException - if no such session exists
        java.lang.IllegalStateException - if engine is not running
      • getUserData

        java.lang.Object getUserData​(SessionContext sessionContext,
                                     java.lang.String key)
        get session-private user data by key.
        Parameters:
        sessionContext - context of the session the data was previously added to
        key -
        Returns:
        the user data associated with given key, null if no such data was set.
        Throws:
        java.util.concurrent.RejectedExecutionException - if no such session exists
        java.lang.IllegalStateException - if engine is not running
      • addHost

        PgxFuture<com.fasterxml.jackson.databind.JsonNode> addHost​(java.lang.String hostname)
        Adds a new follower to an existing PGX.D cluster. Only one follower can be joining at a time. The request is propagated to all existing machines in the cluster to prepare them for hand-shaking with the new machine. The response contains a list of existing host names in the cluster. Can be invoked repeatedly with the same hostname until the hostname appears in the response, which means the follower successfully joined. Only implemented in distributed mode.
        Parameters:
        hostname - hostname of the new follower to join the cluster
        Returns:
        json array containing existing host names in the cluster
        Throws:
        java.util.concurrent.RejectedExecutionException - if there is already another follower joining or if the joining operation failed
        Since:
        24.1.0
      • removeHost

        PgxFuture<com.fasterxml.jackson.databind.JsonNode> removeHost​(java.lang.String hostname)
        Removes a follower from an existing PGX.D cluster. Only one follower can be leaving at a time. The request is propagated to all existing machines in the cluster to prepare them for severing the connections with the machine. The cluster must not hold any data (graphs, frames, collections, ...) for a follower to be able to leave. The response contains a list of current host names in the cluster. Can be invoked repeatedly with the same hostname until the hostname is no longer in the response, which means the follower successfully left. Only implemented in distributed mode.
        Parameters:
        hostname - hostname of the follower to leave the cluster
        Returns:
        json array containing current host names in the cluster
        Throws:
        java.util.concurrent.RejectedExecutionException - if there is already another follower leaving or if the leaving operation failed
        Since:
        24.1.0
      • updatePgxConfig

        default PgxFuture<java.lang.Void> updatePgxConfig​(PgxConfig config)
        Replaces the current PGX config with the given configuration. This only affects static permissions (i.e. non-graph) and redaction rules for pre-loaded graphs. Existing permissions on graphs and frames will not be changed.
        Parameters:
        config - the new PGX config
        Returns:
        Since:
        20.1.0
      • updatePgxConfig

        PgxFuture<java.lang.Void> updatePgxConfig​(java.util.Map<PgxConfig.Field,​java.lang.Object> config)
        Replaces the current PGX config with the given configuration. This only affects static permissions (i.e. non-graph) and redaction rules for pre-loaded graphs. Existing permissions on graphs and frames will not be changed.
        Parameters:
        config - the new PGX config
        Returns:
        Since:
        20.1.0
      • updatePgxConfig

        PgxFuture<java.lang.Void> updatePgxConfig​(java.io.InputStream config)
        Replaces the current PGX config with the given configuration. This only affects static permissions (i.e. non-graph) and redaction rules for pre-loaded graphs. Existing permissions on graphs and frames will not be changed.
        Parameters:
        config - stream that can be read to a new PGX config
        Returns:
        Since:
        20.1.0
      • updatePgxConfig

        PgxFuture<java.lang.Void> updatePgxConfig​(java.lang.String json)
        Replaces the current PGX config with the given configuration. This only affects static permissions (i.e. non-graph) and redaction rules for pre-loaded graphs. Existing permissions on graphs and frames will not be changed.
        Parameters:
        json - JSON string representing the new PGX config
        Returns:
        Since:
        20.1.0
      • setSessionMaxMemorySize

        PgxFuture<java.lang.Void> setSessionMaxMemorySize​(java.lang.String sessionId,
                                                          int size,
                                                          oracle.pgx.common.MemoryUnit unit)
        Set the maximum memory limit for the given session.
        Parameters:
        sessionId - on which session to apply the memory limit
        size - memory limit to be set relative to the provided MemoryUnit
        unit - the MemoryUnit to use for the given size Only supports MemoryUnit.MEGABYTE, MemoryUnit.GIGABYTE, and MemoryUnit.TERABYTE Requires SERVER_MANAGE permission
        Since:
        20.2.1
      • updateMaxAttainableResources

        PgxFuture<java.lang.Void> updateMaxAttainableResources​(int memorySize,
                                                               oracle.pgx.common.MemoryUnit memoryUnit)
        Updates the maximum attainable resources the cluster can expect to grow to by joining additional machines. For the memory resources, setting the value lower or equal than the sum of physical memory of the existing machines in the cluster signals the cluster that no further growth is currently possible, however it does not require the cluster to shrink. Only implemented in distributed mode.
        Parameters:
        memorySize - new maximum attainable memory limit set relative to the provided MemoryUnit
        memoryUnit - the MemoryUnit to use for the given memorySize Only supports MemoryUnit.MEGABYTE, MemoryUnit.GIGABYTE, and MemoryUnit.TERABYTE
        Since:
        24.1.0
      • getUsername

        PgxFuture<java.lang.String> getUsername()
        Get the name of the current user. Returns null in embedded mode
        Returns:
        the name of the current user
        Since:
        21.3.0
      • getUserRoles

        PgxFuture<java.util.Set<java.lang.String>> getUserRoles()
        Get the roles of the current user. Returns null in embedded mode
        Returns:
        the roles of the current user
        Since:
        21.3.0
      • getSystemPermissions

        PgxFuture<java.util.Set<PgxGenericPermission>> getSystemPermissions()
        Get the roles of the current user. Returns null in embedded mode
        Returns:
        the roles of the current user
        Since:
        21.3.0
      • getResourceElasticityStatus

        PgxFuture<oracle.pgx.common.pojo.admin.ResourceElasticityStatus> getResourceElasticityStatus()
        Get the status of the cluster regarding elasticity-related resources. Only implemented in distributed mode.
        Returns:
        the resource elasticity status
        Since:
        24.1.0