Skip to content

Commit

Permalink
minor fixes for code doc (#1049)
Browse files Browse the repository at this point in the history
  • Loading branch information
nopcoder authored Dec 14, 2020
1 parent 77ca99e commit 46e1649
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions catalog/mvcc/cataloger_list_entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (c *cataloger) listEntriesByLevel(ctx context.Context, repository string, r
}

// readParamsType is a struct holding the parameters needed to perform SQL read queries.
// reading is mainly done in the main loop at "loopByLevel". It may happen (hopefully rarely) in getMoreRows.
// reading is mainly done in the main loop at "loopByLevel". It may happen (hopefully rarely) in getMoreRows.
// variables needed for accessing the database are packed and passed down to getMoreRows
type readParamsType struct {
tx db.Tx
Expand All @@ -113,7 +113,7 @@ type readParamsType struct {
branchQueryMap map[int64]sq.SelectBuilder
}

// LoopByLevel Extracts the prefixes(directories) that exist under a certain prefix. (drill down in the object store "directory tree"
// loopByLevel extracts the prefixes(directories) that exist under a certain prefix. (drill down in the object store "directory tree"
// on each iteration, the function does the SQL retrieval from all lineage branches, and the calls "processSinglePrefix" to decide
// which prefix to return from all lineage branches.
// paths are parsed by the delimiter (usually '/')
Expand Down Expand Up @@ -201,7 +201,7 @@ func loopByLevel(tx db.Tx, prefix, after, delimiter string, limit, branchBatchSi
}
}

// "processSinglePrefix" extracts either a single prefix, or a list of leaf entries from results of union-reading from lineage branches
// processSinglePrefix extracts either a single prefix, or a list of leaf entries from results of union-reading from lineage branches
// branch priority map reflect the lineage order, with lower numbers indicating higher priority. it is used to decide which
// branch returned the prefix when the same path was returned by more than one branch.
func processSinglePrefix(unionReadResults []entryPathPrefixInfo, delimiter string, branchPriorityMap map[int64]int,
Expand Down Expand Up @@ -251,7 +251,7 @@ func processSinglePrefix(unionReadResults []entryPathPrefixInfo, delimiter strin
}
}

// getMoreRows reads entries from a single branch after "processSinglePrefix" exhausts a branch before finding the next path.
// getMoreRows reads entries from a single branch after "processSinglePrefix" exhausts a branch before finding the next path.
// "processSinglePrefix" reads more rows for that branch and stores the results directly into branchRanges.
func getMoreRows(path string, branch int64, branchRanges map[int64][]entryPathPrefixInfo, readParams readParamsType) error {
readBuf := make([]entryPathPrefixInfo, 0, readParams.branchBatchSize)
Expand Down Expand Up @@ -300,7 +300,7 @@ func findLowestResultInBranches(branchRanges map[int64][]entryPathPrefixInfo, br
}

// buildBaseLevelQuery builds a map of select queries for each of the branches in the requested branch lineage
// number of entries that will be retrieved for each branch is limitted to branchBatchSize (The reason it is not enough
// number of entries that will be retrieved for each branch is limited to branchBatchSize (The reason it is not enough
// to read a single row is that we may retrieve deleted entries or tombstones, that should be skipped.
// the requested commitID is passed to the base branch as is. each of the lineage branches gets the commit id from its lineage.
func buildBaseLevelQuery(baseBranchID int64, lineage []lineageCommit, branchBatchSize int,
Expand All @@ -313,7 +313,6 @@ func buildBaseLevelQuery(baseBranchID int64, lineage []lineageCommit, branchBatc
return unionMap
}

//
// buildSingleBranchQuery builds a query on a single branch of the lineage returning entries as they were at topCommitID.
// called mainly from "buildBaseLevelQuery" above.
// the other function that calls it is "getMoreRows" that needs entries for a single branch.
Expand Down

0 comments on commit 46e1649

Please sign in to comment.