Skip to content

Commit

Permalink
Removed ContainerName actor; cleaned up container names in general.
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottArbeit committed Jul 28, 2024
1 parent ad25fb0 commit a0bb9ca
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 186 deletions.
13 changes: 6 additions & 7 deletions src/Grace.Actors/Branch.Actor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module Branch =
if basedOn <> ReferenceId.Empty then
task {
let referenceActorProxy = actorProxyFactory.CreateActorProxy<IReferenceActor>(Reference.GetActorId basedOn, ActorName.Reference)
return! referenceActorProxy.Get (branchEvent.Metadata.CorrelationId + $" Creating branch {branchName}")
return! referenceActorProxy.Get branchEvent.Metadata.CorrelationId
}
else
ReferenceDto.Default |> returnTask
Expand Down Expand Up @@ -92,7 +92,7 @@ module Branch =
| Rebased referenceId ->
task {
let referenceActorProxy = actorProxyFactory.CreateActorProxy<IReferenceActor>(Reference.GetActorId referenceId, ActorName.Reference)
let! referenceDto = referenceActorProxy.Get (branchEvent.Metadata.CorrelationId + "Rebasing branch")
let! referenceDto = referenceActorProxy.Get branchEvent.Metadata.CorrelationId
return { currentBranchDto with BasedOn = referenceDto }
}
| NameSet branchName -> { currentBranchDto with BranchName = branchName } |> returnTask
Expand Down Expand Up @@ -159,9 +159,8 @@ module Branch =
match basedOnLink with
| ReferenceLinkType.BasedOn referenceId -> referenceId

logToConsole $"In Branch.Actor.OnActivateAsync: basedOnReferenceId: {basedOnReferenceId}."
let basedOnReferenceActorProxy = actorProxyFactory.CreateActorProxy<IReferenceActor>(Reference.GetActorId basedOnReferenceId, ActorName.Reference)
let! basedOnReferenceDto = basedOnReferenceActorProxy.Get "Activating branch"
let! basedOnReferenceDto = basedOnReferenceActorProxy.Get $"OnActivateAsync-{generateCorrelationId()}"

branchDto <- { branchDto with BasedOn = basedOnReferenceDto }
| External -> ()
Expand Down Expand Up @@ -391,7 +390,7 @@ module Branch =
let referenceCommand = Reference.ReferenceCommand.Create referenceDto
match! referenceActor.Handle referenceCommand metadata with
| Ok _ ->
let! referenceDto = referenceActor.Get (metadata.CorrelationId + "Adding reference")
let! referenceDto = referenceActor.Get metadata.CorrelationId
return Ok referenceDto
| Error error -> return Error error
}
Expand All @@ -409,7 +408,7 @@ module Branch =
if branchName <> InitialBranchName then
// We need to get the reference that we're rebasing on, so we can get the directoryId and sha256Hash.
let referenceActorProxy = actorProxyFactory.CreateActorProxy<IReferenceActor>(Reference.GetActorId basedOn, ActorName.Reference)
let! promotionDto = referenceActorProxy.Get (metadata.CorrelationId + "processCommand1")
let! promotionDto = referenceActorProxy.Get metadata.CorrelationId

match! addReference repositoryId branchId promotionDto.DirectoryId promotionDto.Sha256Hash promotionDto.ReferenceText ReferenceType.Rebase [| ReferenceLinkType.BasedOn promotionDto.ReferenceId |] with
| Ok rebaseReferenceId ->
Expand All @@ -434,7 +433,7 @@ module Branch =

// We need to get the reference that we're rebasing on, so we can get the directoryId and sha256Hash.
let referenceActorProxy = actorProxyFactory.CreateActorProxy<IReferenceActor>(ActorId($"{referenceId}"), ActorName.Reference)
let! promotionDto = referenceActorProxy.Get (metadata.CorrelationId + "processCommand2")
let! promotionDto = referenceActorProxy.Get metadata.CorrelationId

// Add the Rebase reference to this branch.
match! addReferenceToCurrentBranch promotionDto.DirectoryId promotionDto.Sha256Hash promotionDto.ReferenceText ReferenceType.Rebase [| ReferenceLinkType.BasedOn promotionDto.ReferenceId |] with
Expand Down
3 changes: 0 additions & 3 deletions src/Grace.Actors/Constants.Actor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ module Constants =
[<Literal>]
let Checkpoint = "CheckpointActor"

[<Literal>]
let ContainerName = "ContainerNameActor"

[<Literal>]
let Diff = "DiffActor"

Expand Down
109 changes: 0 additions & 109 deletions src/Grace.Actors/ContainerName.Actor.fs

This file was deleted.

5 changes: 4 additions & 1 deletion src/Grace.Actors/DirectoryVersion.Actor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,10 @@ module DirectoryVersion =
))
)

let subdirectoryVersionsList = subdirectoryVersions.ToArray()
let subdirectoryVersionsList =
subdirectoryVersions.ToArray()
|> Array.sortBy(fun directoryVersion -> directoryVersion.RelativePath)
logToConsole $"In DirectoryVersionActor.GetDirectoryVersionsRecursive({this.Id}); Storing subdirectoryVersion list."
do! Storage.SaveState stateManager directoryVersionCacheStateName subdirectoryVersionsList

log.LogDebug("In DirectoryVersionActor.GetDirectoryVersionsRecursive({id}); Storing subdirectoryVersion list.", this.Id)
Expand Down
1 change: 0 additions & 1 deletion src/Grace.Actors/Grace.Actors.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<Compile Include="Repository.Actor.fs" />
<Compile Include="RepositoryName.Actor.fs" />
<Compile Include="RepositoryPermission.Actor.fs" />
<Compile Include="ContainerName.Actor.fs" />
<Compile Include="Diff.Actor.fs" />
<Compile Include="FileAppearance.Actor.fs" />
<Compile Include="DirectoryAppearance.Actor.fs" />
Expand Down
10 changes: 0 additions & 10 deletions src/Grace.Actors/Interfaces.Actor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,6 @@ module Interfaces =
/// Sets the BranchId that matches the BranchName.
abstract member SetBranchId: branchId: BranchId -> correlationId: CorrelationId -> Task

/// Defines the operations for the Commit actor.
[<Interface>]
type IContainerNameActor =
inherit IActor

/// Retrieves the container name for the RepositoryId specified for the actor.
///
/// The container name is $"{ownerName}-{organizationName}-{repositoryName}".
abstract member GetContainerName: correlationId: CorrelationId -> Task<Result<ContainerName, string>>

/// Defines the operations for the Diff actor.
[<Interface>]
type IDiffActor =
Expand Down
2 changes: 1 addition & 1 deletion src/Grace.Actors/Repository.Actor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ module Repository =
OrganizationId = organizationId
ObjectStorageProvider = Constants.DefaultObjectStorageProvider
StorageAccountName = Constants.DefaultObjectStorageAccount
StorageContainerName = StorageContainerName Constants.DefaultObjectStorageContainerName
StorageContainerName = $"{repositoryId}"
CreatedAt = repositoryEvent.Metadata.Timestamp
}
| Initialized -> { currentRepositoryDto with InitializedAt = Some(getCurrentInstant ()) }
Expand Down
Loading

0 comments on commit a0bb9ca

Please sign in to comment.