Package jetbrains.buildServer.serverSide
Interface AgentPersister
-
- All Known Implementing Classes:
AgentPersistenceFacade
public interface AgentPersister
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
generateUniqueAuthorizationToken(BuildAgentEx agent)
Generates new unique token which should be used to authorize this agentLong
getAgentStatusRestoringTimestamp(int agentId)
Returns null if agent status will not be restored, otherwise returns status restoring timestampBoolean
getAgentStatusToRestore(int agentId)
Returns null if agent status will not be restored, otherwise returns status to restoreDate
getBindingTimestamp(int agentId)
Returns last binding timestampvoid
invalidateCaches(BuildAgentEx agent)
Clear all caches that may affect the agentAgentData
loadAgent(int agentId, boolean includeUnregistered)
Load agent data from databaseAgentData
loadAgent(String agentName, boolean includeUnregistered)
List<AgentData>
loadRegisteredAgents()
Load all registered agents from database.void
register(BuildAgentEx agent)
Marks agent as registered in database.void
removeAgent(BuildAgentEx agent)
Removes agent from the database.void
resetAgentCaches(int agentId)
Should be called to cleanup internal caches when server detected that agent was removedvoid
restoreAgentsEnabledStatusesIfNeeded(Function<Integer,BuildAgentEx> agentSupplier)
Restores agents statuses if neededboolean
restoreAgentStatus(BuildAgentEx agent)
Returns true if agent exists in database and its' status has been restored.void
setAgentTypeId(BuildAgentEx agent, int agentTypeId)
Persists agent type idvoid
setAuthorized(BuildAgentEx agent, boolean authorized)
Persists this agent authorized status in database.void
setBindingTimestamp(int agentId, Date timestamp)
Updates agent server last binding timestampvoid
setEnabled(BuildAgentEx agent, boolean enabled)
Persists this agent status enabled status in database.void
setEnabled(BuildAgentEx agent, boolean enabled, long statusRestoringTimestamp)
Persists this agent status enabled status in database.void
unregister(BuildAgentEx agent, String unregisterReason)
Marks agent as unregistered in database.
-
-
-
Method Detail
-
loadRegisteredAgents
@NotNull List<AgentData> loadRegisteredAgents()
Load all registered agents from database.
-
loadAgent
@Nullable AgentData loadAgent(int agentId, boolean includeUnregistered)
Load agent data from database
-
setEnabled
void setEnabled(@NotNull BuildAgentEx agent, boolean enabled)
Persists this agent status enabled status in database.- Parameters:
agent
- which status to persistenabled
- enabled value
-
setEnabled
void setEnabled(@NotNull BuildAgentEx agent, boolean enabled, long statusRestoringTimestamp)
Persists this agent status enabled status in database.- Parameters:
agent
- which status to persistenabled
- enabled valuestatusRestoringTimestamp
- timestamp at which agent status will be restored
-
restoreAgentsEnabledStatusesIfNeeded
void restoreAgentsEnabledStatusesIfNeeded(@NotNull Function<Integer,BuildAgentEx> agentSupplier)
Restores agents statuses if needed
-
setAuthorized
void setAuthorized(@NotNull BuildAgentEx agent, boolean authorized)
Persists this agent authorized status in database.- Parameters:
agent
- which status to persistauthorized
- authorized value
-
setAgentTypeId
void setAgentTypeId(@NotNull BuildAgentEx agent, int agentTypeId)
Persists agent type id- Parameters:
agent
- agentagentTypeId
- agent type id
-
restoreAgentStatus
boolean restoreAgentStatus(@NotNull BuildAgentEx agent)
Returns true if agent exists in database and its' status has been restored.- Parameters:
agent
- agent to restore- Returns:
- true if agent exists in database and its' status has been restored and false otherwise
-
register
void register(@NotNull BuildAgentEx agent)
Marks agent as registered in database.- Parameters:
agent
- agent to update
-
unregister
void unregister(@NotNull BuildAgentEx agent, @NotNull String unregisterReason)
Marks agent as unregistered in database.- Parameters:
agent
- agent to updateunregisterReason
- reason of unregistering
-
generateUniqueAuthorizationToken
void generateUniqueAuthorizationToken(BuildAgentEx agent)
Generates new unique token which should be used to authorize this agent- Parameters:
agent
- agent
-
removeAgent
void removeAgent(@NotNull BuildAgentEx agent)
Removes agent from the database.- Parameters:
agent
- agent to remove
-
resetAgentCaches
void resetAgentCaches(int agentId)
Should be called to cleanup internal caches when server detected that agent was removed- Parameters:
agent
-- Since:
- 2020.2.1
-
setBindingTimestamp
void setBindingTimestamp(int agentId, @NotNull Date timestamp)
Updates agent server last binding timestamp- Parameters:
agentId
- agent idtimestamp
- timestamp
-
getBindingTimestamp
@Nullable Date getBindingTimestamp(int agentId)
Returns last binding timestamp- Parameters:
agentId
- agent id- Returns:
- see above
-
getAgentStatusToRestore
@Nullable Boolean getAgentStatusToRestore(int agentId)
Returns null if agent status will not be restored, otherwise returns status to restore- Parameters:
agentId
- agent id- Returns:
- null if agent status will not be restored, otherwise returns status to restore
-
getAgentStatusRestoringTimestamp
@Nullable Long getAgentStatusRestoringTimestamp(int agentId)
Returns null if agent status will not be restored, otherwise returns status restoring timestamp- Parameters:
agentId
- agent id- Returns:
- null if agent status will not be restored, otherwise returns status restoring timestamp
-
invalidateCaches
void invalidateCaches(@NotNull BuildAgentEx agent)
Clear all caches that may affect the agent
-
-