Interface Repository
- All Known Subinterfaces:
MetaRepository
public interface Repository
Revision-controlled filesystem-like repository.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(RepositoryListener listener) Adds theRepositoryListener
that gets notified whenever changes matching withRepositoryListener.pathPattern()
are pushed to thisRepository
.author()
Returns the author who created thisRepository
.default CompletableFuture
<CommitResult> commit
(Revision baseRevision, long commitTimeMillis, Author author, String summary, Change<?>... changes) Adds the specified changes to thisRepository
.default CompletableFuture
<CommitResult> commit
(Revision baseRevision, long commitTimeMillis, Author author, String summary, Iterable<Change<?>> changes) Adds the specified changes to thisRepository
.default CompletableFuture
<CommitResult> commit
(Revision baseRevision, long commitTimeMillis, Author author, String summary, String detail, Markup markup, Change<?>... changes) Adds the specified changes to thisRepository
.commit
(Revision baseRevision, long commitTimeMillis, Author author, String summary, String detail, Markup markup, ContentTransformer<?> transformer) Adds the content that is transformed by the specifiedContentTransformer
to thisRepository
.commit
(Revision baseRevision, long commitTimeMillis, Author author, String summary, String detail, Markup markup, Iterable<Change<?>> changes, boolean directExecution) Adds the specified changes to thisRepository
.long
Returns the creation time of thisRepository
.default CompletableFuture
<Change<?>> Query a file at two different revisions and return the diff of the two query results.default CompletableFuture
<Change<?>> diff
(Revision from, Revision to, Query<?> query, DiffResultType diffResultType) Query a file at two different revisions and return the diff of the two query results.default CompletableFuture
<Map<String, Change<?>>> Returns the diff for all files that are matched by the specifiedpathPattern
between the specified twoRevision
s.CompletableFuture
<Map<String, Change<?>>> diff
(Revision from, Revision to, String pathPattern, DiffResultType diffResultType) Returns the diff for all files that are matched by the specifiedpathPattern
between the specified twoRevision
s.default CompletableFuture
<Boolean> default CompletableFuture
<Map<String, Entry<?>>> Finds theEntry
s that match the specifiedpathPattern
.CompletableFuture
<Map<String, Entry<?>>> find
(Revision revision, String pathPattern, Map<FindOption<?>, ?> options) Finds theEntry
s that match the specifiedpathPattern
.default CompletableFuture
<Revision> findLatestRevision
(Revision lastKnownRevision, String pathPattern) findLatestRevision
(Revision lastKnownRevision, String pathPattern, boolean errorOnEntryNotFound) default <T> CompletableFuture
<Entry<T>> Performs the specifiedQuery
.default CompletableFuture
<Entry<?>> Retrieves anEntry
at the specifiedpath
.default <T> CompletableFuture
<Entry<T>> Performs the specifiedQuery
.default CompletableFuture
<Entry<?>> Retrieves anEntry
at the specifiedpath
.default CompletableFuture
<List<Commit>> Get a list ofCommit
for given pathPattern.Get a list ofCommit
for given pathPattern.org.eclipse.jgit.lib.Repository
Returns the jGitRepository
.default <T> CompletableFuture
<MergedEntry<T>> mergeFiles
(Revision revision, MergeQuery<T> query) Merges the JSON files sequentially as specified in theMergeQuery
.name()
Returns the name of thisRepository
.default CompletableFuture
<Revision> Deprecated.normalizeNow
(Revision revision) normalizeNow
(Revision from, Revision to) parent()
Returns the parentProject
of thisRepository
.default CompletableFuture
<Map<String, Change<?>>> previewDiff
(Revision baseRevision, Change<?>... changes) Generates the preview diff against the specifiedbaseRevision
andchanges
.CompletableFuture
<Map<String, Change<?>>> previewDiff
(Revision baseRevision, Iterable<Change<?>> changes) Generates the preview diff against the specifiedbaseRevision
andchanges
.void
removeListener
(RepositoryListener listener) Removes theRepositoryListener
from thisRepository
.default <T> CompletableFuture
<Entry<T>> Awaits and retrieves the change in the query result of the specified file asynchronously since the specified last known revision.default <T> CompletableFuture
<Entry<T>> Awaits and retrieves the change in the query result of the specified file asynchronously since the specified last known revision.default CompletableFuture
<Revision> Awaits and retrieves the latest revision of the commit that changed the file that matches the specifiedpathPattern
since the specified last known revision.Awaits and retrieves the latest revision of the commit that changed the file that matches the specifiedpathPattern
since the specified last known revision.
-
Field Details
-
DEFAULT_MAX_COMMITS
static final int DEFAULT_MAX_COMMITS- See Also:
-
MAX_MAX_COMMITS
static final int MAX_MAX_COMMITS- See Also:
-
ALL_PATH
- See Also:
-
-
Method Details
-
jGitRepository
org.eclipse.jgit.lib.Repository jGitRepository()Returns the jGitRepository
. -
parent
Project parent()Returns the parentProject
of thisRepository
. -
name
String name()Returns the name of thisRepository
. -
creationTimeMillis
long creationTimeMillis()Returns the creation time of thisRepository
. -
author
Author author()Returns the author who created thisRepository
. -
normalize
Deprecated. -
normalizeNow
- Throws:
RevisionNotFoundException
- if the specifiedRevision
is not found
-
normalizeNow
- Throws:
RevisionNotFoundException
- if the specifiedfrom
orto
is not found
-
exists
-
get
Retrieves anEntry
at the specifiedpath
.- Throws:
EntryNotFoundException
- if there's no entry at the specifiedpath
- See Also:
-
get
Performs the specifiedQuery
.- Throws:
EntryNotFoundException
- if there's no entry at the path specified in theQuery
- See Also:
-
getOrNull
Retrieves anEntry
at the specifiedpath
. -
getOrNull
Performs the specifiedQuery
.- Returns:
- the
Entry
on a successful query. The specifiedother
on a failure due to missing entry. - See Also:
-
find
Finds theEntry
s that match the specifiedpathPattern
. -
find
CompletableFuture<Map<String,Entry<?>>> find(Revision revision, String pathPattern, Map<FindOption<?>, ?> options) Finds theEntry
s that match the specifiedpathPattern
. -
diff
Query a file at two different revisions and return the diff of the two query results. -
diff
default CompletableFuture<Change<?>> diff(Revision from, Revision to, Query<?> query, DiffResultType diffResultType) Query a file at two different revisions and return the diff of the two query results. -
diff
default CompletableFuture<Map<String,Change<?>>> diff(Revision from, Revision to, String pathPattern) Returns the diff for all files that are matched by the specifiedpathPattern
between the specified twoRevision
s.- Throws:
StorageException
- iffrom
orto
does not exist.
-
diff
CompletableFuture<Map<String,Change<?>>> diff(Revision from, Revision to, String pathPattern, DiffResultType diffResultType) Returns the diff for all files that are matched by the specifiedpathPattern
between the specified twoRevision
s.- Throws:
StorageException
- iffrom
orto
does not exist.
-
previewDiff
default CompletableFuture<Map<String,Change<?>>> previewDiff(Revision baseRevision, Change<?>... changes) Generates the preview diff against the specifiedbaseRevision
andchanges
. -
previewDiff
CompletableFuture<Map<String,Change<?>>> previewDiff(Revision baseRevision, Iterable<Change<?>> changes) Generates the preview diff against the specifiedbaseRevision
andchanges
. -
commit
default CompletableFuture<CommitResult> commit(Revision baseRevision, long commitTimeMillis, Author author, String summary, Iterable<Change<?>> changes) Adds the specified changes to thisRepository
. -
commit
default CompletableFuture<CommitResult> commit(Revision baseRevision, long commitTimeMillis, Author author, String summary, Change<?>... changes) Adds the specified changes to thisRepository
. -
commit
default CompletableFuture<CommitResult> commit(Revision baseRevision, long commitTimeMillis, Author author, String summary, String detail, Markup markup, Change<?>... changes) Adds the specified changes to thisRepository
. -
commit
CompletableFuture<CommitResult> commit(Revision baseRevision, long commitTimeMillis, Author author, String summary, String detail, Markup markup, Iterable<Change<?>> changes, boolean directExecution) Adds the specified changes to thisRepository
.- Parameters:
baseRevision
- the baseRevision
of thisCommit
commitTimeMillis
- the time and date of thisCommit
, represented as the number of milliseconds since the epoch (midnight, January 1, 1970 UTC)author
- theAuthor
of thisCommit
summary
- the human-readable summary of thisCommit
detail
- the human-readable detailed description of thisCommit
markup
- theMarkup
language ofsummary
anddetail
changes
- the changes to be applieddirectExecution
- whether thisCommit
is received by this server and executed directly.false
if this commit is delivered by aReplicationLog
.- Returns:
- the
Revision
of the newCommit
-
commit
CompletableFuture<CommitResult> commit(Revision baseRevision, long commitTimeMillis, Author author, String summary, String detail, Markup markup, ContentTransformer<?> transformer) Adds the content that is transformed by the specifiedContentTransformer
to thisRepository
. -
history
Get a list ofCommit
for given pathPattern.- Parameters:
from
- the starting revision (inclusive)to
- the end revision (inclusive)pathPattern
- the path pattern- Returns:
Commit
- Throws:
StorageException
- when any internal error occurs.
-
history
CompletableFuture<List<Commit>> history(Revision from, Revision to, String pathPattern, int maxCommits) Get a list ofCommit
for given pathPattern.- Parameters:
from
- the starting revision (inclusive)to
- the end revision (inclusive)pathPattern
- the path patternmaxCommits
- the maximum number ofCommit
s to return- Returns:
Commit
- Throws:
StorageException
- when any internal error occurs.
-
findLatestRevision
default CompletableFuture<Revision> findLatestRevision(Revision lastKnownRevision, String pathPattern) Returns the latestRevision
if there are anyChange
s sincelastKnownRevision
that affected the path matched by the specifiedpathPattern
. The behavior of this method could be represented as the following code:
.. although it would be implemented more efficiently.RevisionRange range = repository.normalizeNow(lastKnownRevision, Revision.HEAD); return repository.diff(range.from(), range.to(), pathPattern).thenApply(diff -> { if (diff.isEmpty()) { return null; } else { return range.to(); } });
-
findLatestRevision
CompletableFuture<Revision> findLatestRevision(Revision lastKnownRevision, String pathPattern, boolean errorOnEntryNotFound) Returns the latestRevision
if there are anyChange
s sincelastKnownRevision
that affected the path matched by the specifiedpathPattern
. The behavior of this method could be represented as the following code:
.. although it would be implemented more efficiently.RevisionRange range = repository.normalizeNow(lastKnownRevision, Revision.HEAD); return repository.diff(range.from(), range.to(), pathPattern).thenApply(diff -> { if (diff.isEmpty()) { return null; } else { return range.to(); } });
-
watch
Awaits and retrieves the latest revision of the commit that changed the file that matches the specifiedpathPattern
since the specified last known revision. -
watch
CompletableFuture<Revision> watch(Revision lastKnownRevision, String pathPattern, boolean errorOnEntryNotFound) Awaits and retrieves the latest revision of the commit that changed the file that matches the specifiedpathPattern
since the specified last known revision. -
watch
Awaits and retrieves the change in the query result of the specified file asynchronously since the specified last known revision. -
watch
default <T> CompletableFuture<Entry<T>> watch(Revision lastKnownRevision, Query<T> query, boolean errorOnEntryNotFound) Awaits and retrieves the change in the query result of the specified file asynchronously since the specified last known revision. -
mergeFiles
Merges the JSON files sequentially as specified in theMergeQuery
. -
addListener
Adds theRepositoryListener
that gets notified whenever changes matching withRepositoryListener.pathPattern()
are pushed to thisRepository
. -
removeListener
Removes theRepositoryListener
from thisRepository
.
-
normalizeNow(Revision)
.