blob: 5487bbd02029a8e1adf5e244472f1b996e545d0e [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.datasketches.memory;
/**
* Read only interface for a memory mapped file
*
* @author Roman Leventov
* @author Lee Rhodes
* @author Praveenkumar Venkatesan
*/
interface Map extends AutoCloseable {
/**
* Loads content into physical memory. This method makes a best effort to ensure that, when it
* returns, this buffer's content is resident in physical memory. Invoking this method may cause
* some number of page faults and I/O operations to occur.
*
* @see <a href="https://docs.oracle.com/javase/8/docs/api/java/nio/MappedByteBuffer.html#load--">
* java/nio/MappedByteBuffer.load</a>
*/
void load();
/**
* Tells whether or not the content is resident in physical memory. A return value of true implies
* that it is highly likely that all of the data in this buffer is resident in physical memory and
* may therefore be accessed without incurring any virtual-memory page faults or I/O operations. A
* return value of false does not necessarily imply that the content is not resident in physical
* memory. The returned value is a hint, rather than a guarantee, because the underlying operating
* system may have paged out some of the buffer's data by the time that an invocation of this
* method returns.
*
* @return true if loaded
*
* @see <a href=
* "https://docs.oracle.com/javase/8/docs/api/java/nio/MappedByteBuffer.html#isLoaded--"> java
* /nio/MappedByteBuffer.isLoaded</a>
*/
boolean isLoaded();
}