Beispiel #1
0
        /// <inheritdoc />
        public Task <bool> DeleteFileAsync(long fileId, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            return(_delete.Next().DeleteAsync(fileId, token));
        }
Beispiel #2
0
        /// <inheritdoc />
        public Task <bool> ExistsAsync(long wordId, long fileId, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            return(_exists.Next().ExistAsync(wordId, fileId, token));
        }
Beispiel #3
0
        /// <inheritdoc />
        public Task <IList <IPart> > GetIdsAsync(IReadOnlyCollection <string> parts, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            return(_select.Next().GetAsync(parts, token));
        }
Beispiel #4
0
        /// <inheritdoc />
        public Task InsertAsync(IReadOnlyCollection <IPart> parts, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // insert the part.
            return(_insert.Next().InsertAsync(parts, token));
        }
Beispiel #5
0
        /// <inheritdoc />
        public Task <long> GetIdAsync(string word, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // then return the value.
            return(_select.Next().GetIdAsync(word, token));
        }
        /// <inheritdoc />
        public Task <bool> DeleteAsync(long wordId, long partId, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // delete the word/part/
            return(_delete.Next().DeleteAsync(wordId, partId, token));
        }
        /// <inheritdoc />
        public Task <IList <long> > GetPartIdsAsync(long wordid, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // get the data
            return(_select.Next().GetAsync(wordid, token));
        }
        /// <inheritdoc />
        public Task <IList <long> > ExistsAsync(long wordId, IReadOnlyCollection <long> partIds, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // return if it exists.
            return(_exists.Next().ExistAsync(wordId, partIds, token));
        }
        /// <inheritdoc />
        public async Task <IList <long> > InsertAsync(long wordId, IReadOnlyCollection <long> partIds, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // try and insert the ids
            var invalidInsertIds = await _insert.Next().InsertAsync(wordId, partIds, token).ConfigureAwait(false);

            // now check the invalid ids to check if they exist.
            return(await ExistsAsync(wordId, invalidInsertIds.ToList(), token).ConfigureAwait(false));
        }
Beispiel #10
0
        /// <inheritdoc />
        public async Task <bool> InsertAsync(long wordId, long fileId, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // try and insert the id
            await _insert.Next().InsertAsync(wordId, fileId, token).ConfigureAwait(false);

            // was there an error ... or is it a duplicate.
            // we have to check outside the lock
            return(await ExistsAsync(wordId, fileId, token).ConfigureAwait(false));
        }
Beispiel #11
0
        /// <inheritdoc />
        public async Task <IList <IPart> > InsertAndGetAsync(IReadOnlyCollection <string> parts, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // insert the part.
            await _insert.Next().InsertAsync(parts, token).ConfigureAwait(false);

            // regardless of the result, get the id, if it existed, get the id
            // and if we inserted it, get the id.
            return(await GetIdsAsync(parts, token).ConfigureAwait(false));
        }
Beispiel #12
0
        /// <inheritdoc />
        public async Task <long> InsertAndGetIdAsync(string word, CancellationToken token)
        {
            // sanity check
            ThrowIfDisposed();

            // just add it.
            await _insert.Next().InsertAsync(word, token).ConfigureAwait(false);

            // regardless of the result, get the id
            // if it existed, get the id
            // if we inserted it, get the id.
            return(await GetIdAsync(word, token).ConfigureAwait(false));
        }