The smart-buffer Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The smart-buffer Reference Manual

This is the smart-buffer Reference Manual, version 0.1, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 09:21:45 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

smart-buffer

Build Status Coverage Status

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

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.

(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

Copyright

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

License

Licensed under the BSD 3-Clause License.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 smart-buffer

Author

Eitaro Fukamachi

License

BSD 3-Clause

Description

Smart octets buffer

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
Source

smart-buffer.asd (file)

Component

src (module)


Next: , Previous: , Up: Top   [Contents][Index]

3 Modules

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


Previous: , Up: Modules   [Contents][Index]

3.1 smart-buffer/src

Parent

smart-buffer (system)

Location

src/

Component

smart-buffer.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

4 Files

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


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

4.1.1 smart-buffer.asd

Location

smart-buffer.asd

Systems

smart-buffer (system)

Packages

smart-buffer-asd


Previous: , Up: Lisp files   [Contents][Index]

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

Parent

src (module)

Location

src/smart-buffer.lisp

Packages

smart-buffer

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

5.1 smart-buffer-asd

Source

smart-buffer.asd

Use List

Previous: , Up: Packages   [Contents][Index]

5.2 smart-buffer

Source

smart-buffer.lisp (file)

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

6 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.1 Special variables

Special Variable: *default-disk-limit*
Package

smart-buffer

Source

smart-buffer.lisp (file)

Special Variable: *default-memory-limit*
Package

smart-buffer

Source

smart-buffer.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.2 Macros

Macro: with-smart-buffer (BUFFER &key MEMORY-LIMIT DISK-LIMIT) &body BODY
Package

smart-buffer

Source

smart-buffer.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.3 Functions

Function: buffer-on-memory-p INSTANCE
Function: (setf buffer-on-memory-p) VALUE INSTANCE
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: finalize-buffer BUFFER
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: make-smart-buffer &rest INITARGS &key MEMORY-LIMIT DISK-LIMIT &allow-other-keys
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: write-to-buffer BUFFER SEQ &optional START END
Package

smart-buffer

Source

smart-buffer.lisp (file)


Next: , Previous: , Up: Exported definitions   [Contents][Index]

6.1.4 Conditions

Condition: buffer-limit-exceeded ()
Package

smart-buffer

Source

smart-buffer.lisp (file)

Direct superclasses

error (condition)

Direct slots
Slot: limit
Initargs

:limit

Initform

(quote nil)


Previous: , Up: Exported definitions   [Contents][Index]

6.1.5 Structures

Structure: smart-buffer ()
Package

smart-buffer

Source

smart-buffer.lisp (file)

Direct superclasses

structure-object (structure)

Direct slots
Slot: memory-limit
Initform

smart-buffer:*default-memory-limit*

Readers

buffer-memory-limit (function)

Writers

(setf buffer-memory-limit) (function)

Slot: disk-limit
Initform

smart-buffer:*default-disk-limit*

Readers

buffer-disk-limit (function)

Writers

(setf buffer-disk-limit) (function)

Slot: current-len
Initform

0

Readers

buffer-current-len (function)

Writers

(setf buffer-current-len) (function)

Slot: on-memory-p
Initform

t

Readers

buffer-on-memory-p (function)

Writers

(setf buffer-on-memory-p) (function)

Slot: memory-buffer
Initform

(xsubseq:make-concatenated-xsubseqs)

Readers

buffer-memory-buffer (function)

Writers

(setf buffer-memory-buffer) (function)

Slot: disk-buffer
Readers

buffer-disk-buffer (function)

Writers

(setf buffer-disk-buffer) (function)


Previous: , Up: Definitions   [Contents][Index]

6.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

6.2.1 Functions

Function: %make-smart-buffer &key (MEMORY-LIMIT MEMORY-LIMIT) (DISK-LIMIT DISK-LIMIT) (CURRENT-LEN CURRENT-LEN) (ON-MEMORY-P ON-MEMORY-P) (MEMORY-BUFFER MEMORY-BUFFER) (DISK-BUFFER DISK-BUFFER)
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: buffer-current-len INSTANCE
Function: (setf buffer-current-len) VALUE INSTANCE
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: buffer-disk-buffer INSTANCE
Function: (setf buffer-disk-buffer) VALUE INSTANCE
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: buffer-disk-limit INSTANCE
Function: (setf buffer-disk-limit) VALUE INSTANCE
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: buffer-memory-buffer INSTANCE
Function: (setf buffer-memory-buffer) VALUE INSTANCE
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: buffer-memory-limit INSTANCE
Function: (setf buffer-memory-limit) VALUE INSTANCE
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: check-limit BUFFER
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: copy-smart-buffer INSTANCE
Package

smart-buffer

Source

smart-buffer.lisp (file)

Function: smart-buffer-p OBJECT
Package

smart-buffer

Source

smart-buffer.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   M   S  
Index Entry  Section

F
File, Lisp, smart-buffer.asd: The smart-buffer<dot>asd file
File, Lisp, smart-buffer/src/smart-buffer.lisp: The smart-buffer/src/smart-buffer<dot>lisp file

L
Lisp File, smart-buffer.asd: The smart-buffer<dot>asd file
Lisp File, smart-buffer/src/smart-buffer.lisp: The smart-buffer/src/smart-buffer<dot>lisp file

M
Module, smart-buffer/src: The smart-buffer/src module

S
smart-buffer.asd: The smart-buffer<dot>asd file
smart-buffer/src: The smart-buffer/src module
smart-buffer/src/smart-buffer.lisp: The smart-buffer/src/smart-buffer<dot>lisp file

Jump to:   F   L   M   S  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

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

%
%make-smart-buffer: Internal functions

(
(setf buffer-current-len): Internal functions
(setf buffer-disk-buffer): Internal functions
(setf buffer-disk-limit): Internal functions
(setf buffer-memory-buffer): Internal functions
(setf buffer-memory-limit): Internal functions
(setf buffer-on-memory-p): Exported functions

B
buffer-current-len: Internal functions
buffer-disk-buffer: Internal functions
buffer-disk-limit: Internal functions
buffer-memory-buffer: Internal functions
buffer-memory-limit: Internal functions
buffer-on-memory-p: Exported functions

C
check-limit: Internal functions
copy-smart-buffer: Internal functions

F
finalize-buffer: Exported functions
Function, %make-smart-buffer: Internal functions
Function, (setf buffer-current-len): Internal functions
Function, (setf buffer-disk-buffer): Internal functions
Function, (setf buffer-disk-limit): Internal functions
Function, (setf buffer-memory-buffer): Internal functions
Function, (setf buffer-memory-limit): Internal functions
Function, (setf buffer-on-memory-p): Exported functions
Function, buffer-current-len: Internal functions
Function, buffer-disk-buffer: Internal functions
Function, buffer-disk-limit: Internal functions
Function, buffer-memory-buffer: Internal functions
Function, buffer-memory-limit: Internal functions
Function, buffer-on-memory-p: Exported functions
Function, check-limit: Internal functions
Function, copy-smart-buffer: Internal functions
Function, finalize-buffer: Exported functions
Function, make-smart-buffer: Exported functions
Function, smart-buffer-p: Internal functions
Function, write-to-buffer: Exported functions

M
Macro, with-smart-buffer: Exported macros
make-smart-buffer: Exported functions

S
smart-buffer-p: Internal functions

W
with-smart-buffer: Exported macros
write-to-buffer: Exported functions

Jump to:   %   (  
B   C   F   M   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
C   D   L   M   O   S  
Index Entry  Section

*
*default-disk-limit*: Exported special variables
*default-memory-limit*: Exported special variables

C
current-len: Exported structures

D
disk-buffer: Exported structures
disk-limit: Exported structures

L
limit: Exported conditions

M
memory-buffer: Exported structures
memory-limit: Exported structures

O
on-memory-p: Exported structures

S
Slot, current-len: Exported structures
Slot, disk-buffer: Exported structures
Slot, disk-limit: Exported structures
Slot, limit: Exported conditions
Slot, memory-buffer: Exported structures
Slot, memory-limit: Exported structures
Slot, on-memory-p: Exported structures
Special Variable, *default-disk-limit*: Exported special variables
Special Variable, *default-memory-limit*: Exported special variables

Jump to:   *  
C   D   L   M   O   S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   B   C   P   S  
Index Entry  Section

B
buffer-limit-exceeded: Exported conditions

C
Condition, buffer-limit-exceeded: Exported conditions

P
Package, smart-buffer: The smart-buffer package
Package, smart-buffer-asd: The smart-buffer-asd package

S
smart-buffer: The smart-buffer system
smart-buffer: The smart-buffer package
smart-buffer: Exported structures
smart-buffer-asd: The smart-buffer-asd package
Structure, smart-buffer: Exported structures
System, smart-buffer: The smart-buffer system

Jump to:   B   C   P   S