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 voidgenerateUniqueAuthorizationToken(BuildAgentEx agent)Generates new unique token which should be used to authorize this agentLonggetAgentStatusRestoringTimestamp(int agentId)Returns null if agent status will not be restored, otherwise returns status restoring timestampBooleangetAgentStatusToRestore(int agentId)Returns null if agent status will not be restored, otherwise returns status to restoreDategetBindingTimestamp(int agentId)Returns last binding timestampvoidinvalidateCaches(BuildAgentEx agent)Clear all caches that may affect the agentAgentDataloadAgent(int agentId, boolean includeUnregistered)Load agent data from databaseAgentDataloadAgent(String agentName, boolean includeUnregistered)List<AgentData>loadRegisteredAgents()Load all registered agents from database.voidregister(BuildAgentEx agent)Marks agent as registered in database.voidremoveAgent(BuildAgentEx agent)Removes agent from the database.voidresetAgentCaches(int agentId)Should be called to cleanup internal caches when server detected that agent was removedvoidrestoreAgentsEnabledStatusesIfNeeded(Function<Integer,BuildAgentEx> agentSupplier)Restores agents statuses if neededbooleanrestoreAgentStatus(BuildAgentEx agent)Returns true if agent exists in database and its' status has been restored.voidsetAgentTypeId(BuildAgentEx agent, int agentTypeId)Persists agent type idvoidsetAuthorized(BuildAgentEx agent, boolean authorized)Persists this agent authorized status in database.voidsetBindingTimestamp(int agentId, Date timestamp)Updates agent server last binding timestampvoidsetEnabled(BuildAgentEx agent, boolean enabled)Persists this agent status enabled status in database.voidsetEnabled(BuildAgentEx agent, boolean enabled, long statusRestoringTimestamp)Persists this agent status enabled status in database.voidunregister(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
-
-