# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0.  If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright 1997 - July 2008 CWI, August 2008 - 2016 MonetDB B.V.

module bbp;

pattern bind(name:str):bat[:any_2]
address CMDbbpbind
comment "Locate the BAT using its logical name";

command getIndex(b:bat[:any_2]):int
address CMDbbpgetIndex
comment "Retrieve the index in the BBP";

command getNames() :bat[:str] 	
address CMDbbpNames
comment "Map BAT into its bbp name";

command get() (id:bat[:int], 
			ns:bat[:str],
	       tt:bat[:str],
	       cnt:bat[:lng], refcnt:bat[:int],
	       lrefcnt:bat[:int], location:bat[:str],
	       heat:bat[:int], dirty:bat[:str],
	       status:bat[:str], kind:bat[:str])
address CMDbbp
comment "bpp";

command getName( b:bat[:any_1]):str
address CMDbbpName
comment "Map a BAT into its internal name";
command setName( b:bat[:any_1], n:str):str
address CMDsetName
comment "Rename a BAT";
command getCount() :bat[:lng] 	
address CMDbbpCount
comment "Create a BAT with the cardinalities of all known BATs";
command getRefCount() :bat[:int] 	
address CMDbbpRefCount
comment "Create a BAT with the (hard) reference counts";
command getLRefCount() :bat[:int] 	
address CMDbbpLRefCount
comment "Create a BAT with the logical reference counts";
command getLocation() :bat[:str] 	
address CMDbbpLocation
comment "Create a BAT with their disk locations";
command getDirty() :bat[:str] 	
address CMDbbpDirty
comment "Create a BAT with the dirty/ diffs/clean status";
command getStatus() :bat[:str] 	
address CMDbbpStatus
comment "Create a BAT with the disk/load status";
command getKind():bat[:str] 
address CMDbbpKind
comment "Create a BAT with the persistency status";
command getRefCount(b:bat[:any_1]) :int
address CMDgetBATrefcnt
comment "Utility for debugging MAL interpreter";
command getLRefCount(b:bat[:any_1]) :int
address CMDgetBATlrefcnt
comment "Utility for debugging MAL interpreter";
command getDiskSpace() :lng
address CMDbbpDiskSpace
comment "Estimate the amount of disk space occupied by dbpath";
command getPageSize():int
address CMDgetPageSize
comment "Obtain the memory page size";
