#lang scheme/base
(require scheme/contract
syntax/boundmap)
(define info-cache (make-module-identifier-mapping))
(define-struct persistent-struct-info
(entity-id attribute-ids attribute-names)
#:transparent)
(define (persistent-struct-info-set! id entity-id attr-ids attr-names)
(module-identifier-mapping-put! info-cache id (make-persistent-struct-info entity-id attr-ids attr-names)))
(define (persistent-struct-info-set? id)
(with-handlers ([exn? (lambda _ #f)])
(module-identifier-mapping-get info-cache id)
#t))
(define (persistent-struct-info-ref id)
(module-identifier-mapping-get info-cache id))
(provide/contract
[struct persistent-struct-info ([entity-id identifier?]
[attribute-ids (listof identifier?)]
[attribute-names (listof symbol?)])]
[persistent-struct-info-set! (-> identifier? identifier? (listof identifier?) (listof symbol?) void?)]
[persistent-struct-info-set? (-> identifier? boolean?)]
[persistent-struct-info-ref (-> identifier? (or/c persistent-struct-info? false/c))])