Skip to content

Commit

Permalink
Cleanup: more unused classes and methods
Browse files Browse the repository at this point in the history
Signed-off-by: Derrick Stolee <stolee@gmail.com>
  • Loading branch information
derrickstolee committed Aug 13, 2019
1 parent 5cd1076 commit 7db6823
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 105 deletions.
13 changes: 0 additions & 13 deletions Scalar.Common/Git/ScalarGitObjects.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
using Scalar.Common.Http;
using Scalar.Common.Tracing;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading;

Expand Down Expand Up @@ -38,16 +35,6 @@ public DownloadAndSaveObjectResult TryDownloadAndSaveObject(string objectId, Req
return this.TryDownloadAndSaveObject(objectId, CancellationToken.None, requestSource, retryOnFailure: true);
}

public bool TryGetBlobSizeLocally(string sha, out long length)
{
return this.Context.Repository.TryGetBlobLength(sha, out length);
}

public List<GitObjectsHttpRequestor.GitObjectSize> GetFileSizes(IEnumerable<string> objectIds, CancellationToken cancellationToken)
{
return this.GitObjectRequestor.QueryForFileSizes(objectIds, cancellationToken);
}

private DownloadAndSaveObjectResult TryDownloadAndSaveObject(
string objectId,
CancellationToken cancellationToken,
Expand Down
22 changes: 0 additions & 22 deletions Scalar.Common/Prefetch/BlobPrefetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ public class BlobPrefetcher

private FileBasedDictionary<string, string> lastPrefetchArgs;

public BlobPrefetcher(
ITracer tracer,
Enlistment enlistment,
GitObjectsHttpRequestor objectRequestor,
int chunkSize,
int searchThreadCount,
int downloadThreadCount,
int indexThreadCount)
: this(tracer, enlistment, objectRequestor, null, null, null, chunkSize, searchThreadCount, downloadThreadCount, indexThreadCount)
{
}

public BlobPrefetcher(
ITracer tracer,
Enlistment enlistment,
Expand Down Expand Up @@ -202,16 +190,6 @@ public static void AppendToNewlineSeparatedFile(PhysicalFileSystem fileSystem, s
}
}

/// <param name="branchOrCommit">A specific branch to filter for, or null for all branches returned from info/refs</param>
public virtual void Prefetch(string branchOrCommit, bool isBranch)
{
int matchedBlobCount;
int downloadedBlobCount;
int hydratedFileCount;

this.PrefetchWithStats(branchOrCommit, isBranch, false, out matchedBlobCount, out downloadedBlobCount, out hydratedFileCount);
}

public void PrefetchWithStats(
string branchOrCommit,
bool isBranch,
Expand Down
66 changes: 0 additions & 66 deletions Scalar.Common/RepoMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ public string EnlistmentId
}
}

public string DataFilePath
{
get { return this.repoMetadata.DataFilePath; }
}

public static bool TryInitialize(ITracer tracer, string dotScalarPath, out string error)
{
return TryInitialize(tracer, new PhysicalFileSystem(), dotScalarPath, out error);
Expand Down Expand Up @@ -142,36 +137,6 @@ public void SaveCloneMetadata(ITracer tracer, ScalarEnlistment enlistment)
});
}

public void SetProjectionInvalid(bool invalid)
{
this.SetInvalid(Keys.ProjectionInvalid, invalid);
}

public bool GetProjectionInvalid()
{
return this.HasEntry(Keys.ProjectionInvalid);
}

public void SetPlaceholdersNeedUpdate(bool needUpdate)
{
this.SetInvalid(Keys.PlaceholdersNeedUpdate, needUpdate);
}

public bool GetPlaceholdersNeedUpdate()
{
return this.HasEntry(Keys.PlaceholdersNeedUpdate);
}

public void SetProjectionInvalidAndPlaceholdersNeedUpdate()
{
this.repoMetadata.SetValuesAndFlush(
new[]
{
new KeyValuePair<string, string>(Keys.ProjectionInvalid, bool.TrueString),
new KeyValuePair<string, string>(Keys.PlaceholdersNeedUpdate, bool.TrueString)
});
}

public bool TryGetGitObjectsRoot(out string gitObjectsRoot, out string error)
{
gitObjectsRoot = null;
Expand Down Expand Up @@ -221,11 +186,6 @@ public bool TryGetLocalCacheRoot(out string localCacheRoot, out string error)
return true;
}

public void SetLocalCacheRoot(string localCacheRoot)
{
this.repoMetadata.SetValueAndFlush(Keys.LocalCacheRoot, localCacheRoot);
}

public bool TryGetBlobSizesRoot(out string blobSizesRoot, out string error)
{
blobSizesRoot = null;
Expand Down Expand Up @@ -267,36 +227,10 @@ private static string CreateNewEnlistmentId(ITracer tracer)
return enlistmentId;
}

private void SetInvalid(string keyName, bool invalid)
{
if (invalid)
{
this.repoMetadata.SetValueAndFlush(keyName, bool.TrueString);
}
else
{
this.repoMetadata.RemoveAndFlush(keyName);
}
}

private bool HasEntry(string keyName)
{
string value;
if (this.repoMetadata.TryGetValue(keyName, out value))
{
return true;
}

return false;
}

public static class Keys
{
public const string ProjectionInvalid = "ProjectionInvalid";
public const string PlaceholdersInvalid = "PlaceholdersInvalid";
public const string DiskLayoutMajorVersion = "DiskLayoutVersion";
public const string DiskLayoutMinorVersion = "DiskLayoutMinorVersion";
public const string PlaceholdersNeedUpdate = "PlaceholdersNeedUpdate";
public const string GitObjectsRoot = "GitObjectsRoot";
public const string LocalCacheRoot = "LocalCacheRoot";
public const string BlobSizesRoot = "BlobSizesRoot";
Expand Down
4 changes: 0 additions & 4 deletions Scalar.Common/ScalarConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,7 @@ public static class Databases
{
public const string Name = "databases";

public static readonly string BackgroundFileSystemTasks = Path.Combine(Name, "BackgroundGitOperations.dat");
public static readonly string PlaceholderList = Path.Combine(Name, "PlaceholderList.dat");
public static readonly string ModifiedPaths = Path.Combine(Name, "ModifiedPaths.dat");
public static readonly string RepoMetadata = Path.Combine(Name, "RepoMetadata.dat");
public static readonly string Scalar = Path.Combine(Name, "Scalar.sqlite");
}

public static class GitStatusCache
Expand Down

0 comments on commit 7db6823

Please sign in to comment.