Skip to content

Commit

Permalink
add LargeObjectCache and related APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
t-horikawa committed Feb 4, 2025
1 parent b99bf5b commit 7164f86
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2023-2025 Project Tsurugi.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tsurugidb.tsubakuro.sql;

import java.io.IOException;
import java.nio.file.Path;
import java.util.Optional;

/**
* Represents large object cache.
*/
public interface LargeObjectCache {

/**
* Returns the path of the file that represents the large object, only if it exists.
* The returned Path is available until close() of this object is invoked.
* @return the path of the file, or empty if it does not exist
*/
Optional<Path> find();

/**
* Copy the large object to the file indicated by the given path.
* Files created by this method are not affected by close() of this object.
* @param destination the path of the destination file
* @throws IOException if I/O error was occurred while copying the large object to the file
*/
void copyTo(Path destination) throws IOException;

/**
* Closes the object cache. The file whose Path has been returned by find() may be deleted.
*/
void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,26 @@ default FutureResponse<Reader> openReader(ClobReference ref) throws IOException
throw new UnsupportedOperationException();
}

/**
* Returns an object cache for the blob.
* @return a future response of a LargeObjectCache
* @param ref the blob reference
* @throws IOException if I/O error was occurred while sending request
*/
default FutureResponse<LargeObjectCache> getLargeObjectCache(BlobReference ref) throws IOException {
throw new UnsupportedOperationException();
}

/**
* Returns an object cache for the clob.
* @return a future response of a LargeObjectCache
* @param ref the clob reference
* @throws IOException if I/O error was occurred while sending request
*/
default FutureResponse<LargeObjectCache> getLargeObjectCache(ClobReference ref) throws IOException {
throw new UnsupportedOperationException();
}

/**
* Disposes the underlying server resources.
* Note that, this never closes the underlying {@link Session}.
Expand Down

0 comments on commit 7164f86

Please sign in to comment.