The smart-buffer Reference Manual

This is the smart-buffer Reference Manual, version 0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 17:54:46 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 smart-buffer

Smart octets buffer

Author

Eitaro Fukamachi

License

BSD 3-Clause

Long Description

# smart-buffer

[![Build Status](https://travis-ci.org/fukamachi/smart-buffer.svg?branch=master)](https://travis-ci.org/fukamachi/smart-buffer)
[![Coverage Status](https://coveralls.io/repos/fukamachi/smart-buffer/badge.svg?branch=master)](https://coveralls.io/r/fukamachi/smart-buffer)

Smart-buffer provides an output buffer which changes the destination depending on content size.

* In-memory buffer for small data
* Temporary files on disk for big data

In-memory buffer is fast to read/write, however, it consumes much memory if the data can be large. On the other hand, files on disk are slower. Smart-buffer would be useful when the buffer must satisfy these two contradicting demands.

## Usage

‘with-smart-buffer‘ returns an in-memory stream or a file stream.

“‘common-lisp
(with-smart-buffer (buffer)
(write-to-buffer buffer (flex:string-to-octets "foobar")))
;=> #<FLEXI-STREAMS::VECTOR-INPUT-STREAM {100456A9A3}>

(with-smart-buffer (buffer :memory-limit 3)
(write-to-buffer buffer (flex:string-to-octets "foobar")))
;=> #<SB-SYS:FD-STREAM for "file /private/var/folders/x3/8n07clk15tq3m4y6_yrmjy6c0000gn/T/tmpAR3FSGEY.tmp" {1005D06503}>
“‘

## Author

* Eitaro Fukamachi (e.arrows@gmail.com)

## Copyright

Copyright (c) 2015 Eitaro Fukamachi (e.arrows@gmail.com)

## License

Licensed under the BSD 3-Clause License.

Version

0.1

Dependencies
  • xsubseq (system).
  • flexi-streams (system).
  • uiop (system).
Source

smart-buffer.asd.

Child Component

src (module).


3 Modules

Modules are listed depth-first from the system components tree.


3.1 smart-buffer/src

Source

smart-buffer.asd.

Parent Component

smart-buffer (system).

Child Component

smart-buffer.lisp (file).


4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


4.1 Lisp


4.1.1 smart-buffer/smart-buffer.asd

Source

smart-buffer.asd.

Parent Component

smart-buffer (system).

ASDF Systems

smart-buffer.

Packages

smart-buffer-asd.


4.1.2 smart-buffer/src/smart-buffer.lisp

Source

smart-buffer.asd.

Parent Component

src (module).

Packages

smart-buffer.

Public Interface
Internals

5 Packages

Packages are listed by definition order.


5.1 smart-buffer-asd

Source

smart-buffer.asd.

Use List
  • asdf/interface.
  • common-lisp.

5.2 smart-buffer

Source

smart-buffer.lisp.

Use List
  • common-lisp.
  • xsubseq.
Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


6.1 Public Interface


6.1.1 Special variables

Special Variable: *default-disk-limit*
Package

smart-buffer.

Source

smart-buffer.lisp.

Special Variable: *default-memory-limit*
Package

smart-buffer.

Source

smart-buffer.lisp.


6.1.2 Macros

Macro: with-smart-buffer ((buffer &key memory-limit disk-limit) &body body)
Package

smart-buffer.

Source

smart-buffer.lisp.


6.1.3 Ordinary functions

Reader: buffer-on-memory-p (instance)
Writer: (setf buffer-on-memory-p) (instance)
Package

smart-buffer.

Source

smart-buffer.lisp.

Target Slot

on-memory-p.

Function: delete-stream-file (stream)
Package

smart-buffer.

Source

smart-buffer.lisp.

Function: delete-temporary-files (&key stale-seconds)
Package

smart-buffer.

Source

smart-buffer.lisp.

Function: finalize-buffer (buffer)
Package

smart-buffer.

Source

smart-buffer.lisp.

Function: make-smart-buffer (&rest initargs &key memory-limit disk-limit &allow-other-keys)
Package

smart-buffer.

Source

smart-buffer.lisp.

Function: write-to-buffer (buffer seq &optional start end)
Package

smart-buffer.

Source

smart-buffer.lisp.


6.1.4 Conditions

Condition: buffer-limit-exceeded
Package

smart-buffer.

Source

smart-buffer.lisp.

Direct superclasses

error.

Direct slots
Slot: limit
Initform

(quote nil)

Initargs

:limit


6.1.5 Structures

Structure: smart-buffer
Package

smart-buffer.

Source

smart-buffer.lisp.

Direct superclasses

structure-object.

Direct slots
Slot: memory-limit
Initform

smart-buffer:*default-memory-limit*

Readers

buffer-memory-limit.

Writers

(setf buffer-memory-limit).

Slot: disk-limit
Initform

smart-buffer:*default-disk-limit*

Readers

buffer-disk-limit.

Writers

(setf buffer-disk-limit).

Slot: current-len
Initform

0

Readers

buffer-current-len.

Writers

(setf buffer-current-len).

Slot: on-memory-p
Initform

t

Readers

buffer-on-memory-p.

Writers

(setf buffer-on-memory-p).

Slot: memory-buffer
Initform

(xsubseq:make-concatenated-xsubseqs)

Readers

buffer-memory-buffer.

Writers

(setf buffer-memory-buffer).

Slot: disk-buffer
Readers

buffer-disk-buffer.

Writers

(setf buffer-disk-buffer).


6.2 Internals


6.2.1 Special variables

Special Variable: *temporary-directory*
Package

smart-buffer.

Source

smart-buffer.lisp.


6.2.2 Ordinary functions

Function: %make-smart-buffer (&key memory-limit disk-limit current-len on-memory-p memory-buffer disk-buffer)
Package

smart-buffer.

Source

smart-buffer.lisp.

Reader: buffer-current-len (instance)
Writer: (setf buffer-current-len) (instance)
Package

smart-buffer.

Source

smart-buffer.lisp.

Target Slot

current-len.

Reader: buffer-disk-buffer (instance)
Writer: (setf buffer-disk-buffer) (instance)
Package

smart-buffer.

Source

smart-buffer.lisp.

Target Slot

disk-buffer.

Reader: buffer-disk-limit (instance)
Writer: (setf buffer-disk-limit) (instance)
Package

smart-buffer.

Source

smart-buffer.lisp.

Target Slot

disk-limit.

Reader: buffer-memory-buffer (instance)
Writer: (setf buffer-memory-buffer) (instance)
Package

smart-buffer.

Source

smart-buffer.lisp.

Target Slot

memory-buffer.

Reader: buffer-memory-limit (instance)
Writer: (setf buffer-memory-limit) (instance)
Package

smart-buffer.

Source

smart-buffer.lisp.

Target Slot

memory-limit.

Function: check-limit (buffer)
Package

smart-buffer.

Source

smart-buffer.lisp.

Function: copy-smart-buffer (instance)
Package

smart-buffer.

Source

smart-buffer.lisp.

Function: smart-buffer-p (object)
Package

smart-buffer.

Source

smart-buffer.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
B   C   D   F   M   S   W  
Index Entry  Section

%
%make-smart-buffer: Private ordinary functions

(
(setf buffer-current-len): Private ordinary functions
(setf buffer-disk-buffer): Private ordinary functions
(setf buffer-disk-limit): Private ordinary functions
(setf buffer-memory-buffer): Private ordinary functions
(setf buffer-memory-limit): Private ordinary functions
(setf buffer-on-memory-p): Public ordinary functions

B
buffer-current-len: Private ordinary functions
buffer-disk-buffer: Private ordinary functions
buffer-disk-limit: Private ordinary functions
buffer-memory-buffer: Private ordinary functions
buffer-memory-limit: Private ordinary functions
buffer-on-memory-p: Public ordinary functions

C
check-limit: Private ordinary functions
copy-smart-buffer: Private ordinary functions

D
delete-stream-file: Public ordinary functions
delete-temporary-files: Public ordinary functions

F
finalize-buffer: Public ordinary functions
Function, %make-smart-buffer: Private ordinary functions
Function, (setf buffer-current-len): Private ordinary functions
Function, (setf buffer-disk-buffer): Private ordinary functions
Function, (setf buffer-disk-limit): Private ordinary functions
Function, (setf buffer-memory-buffer): Private ordinary functions
Function, (setf buffer-memory-limit): Private ordinary functions
Function, (setf buffer-on-memory-p): Public ordinary functions
Function, buffer-current-len: Private ordinary functions
Function, buffer-disk-buffer: Private ordinary functions
Function, buffer-disk-limit: Private ordinary functions
Function, buffer-memory-buffer: Private ordinary functions
Function, buffer-memory-limit: Private ordinary functions
Function, buffer-on-memory-p: Public ordinary functions
Function, check-limit: Private ordinary functions
Function, copy-smart-buffer: Private ordinary functions
Function, delete-stream-file: Public ordinary functions
Function, delete-temporary-files: Public ordinary functions
Function, finalize-buffer: Public ordinary functions
Function, make-smart-buffer: Public ordinary functions
Function, smart-buffer-p: Private ordinary functions
Function, write-to-buffer: Public ordinary functions

M
Macro, with-smart-buffer: Public macros
make-smart-buffer: Public ordinary functions

S
smart-buffer-p: Private ordinary functions

W
with-smart-buffer: Public macros
write-to-buffer: Public ordinary functions