From 9d40b81e008255cf0faa428cc68673ec91687be1 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Thu, 28 Aug 2025 09:31:14 -0400 Subject: [PATCH] tape: Add limits to the API --- tape/error.go | 11 +++++++++++ tape/limits.go | 13 +++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tape/error.go create mode 100644 tape/limits.go diff --git a/tape/error.go b/tape/error.go new file mode 100644 index 0000000..bf078ff --- /dev/null +++ b/tape/error.go @@ -0,0 +1,11 @@ +package tape + +// Error enumerates common errors in this package. +type Error string; const ( + ErrTooLong Error = "data structure too long" +) + +// Error implements the error interface. +func (err Error) Error() string { + return string(err) +} diff --git a/tape/limits.go b/tape/limits.go new file mode 100644 index 0000000..21fee47 --- /dev/null +++ b/tape/limits.go @@ -0,0 +1,13 @@ +package tape + +// MaxStructureLength determines how long a TAPE data structure can be. This +// applies to: +// +// - OTA +// - SBA/LBA +// - KTV +// +// By default it is set at 2^20 (about a million). +// You shouldn't need to change this. If you do, it should only be set once at +// the start of the program. +var MaxStructureLength = 1024 * 1024