Squeak file handling limitations regarding transactions

Paul Fernhout pdfernhout at kurtz-fernhout.com
Wed Jul 12 13:06:42 UTC 2000


Thanks for those who replied on the previous thread on transactions. It
seems the sentiment is that if you want to do (commercial) transactions
with Squeak, hook Squeak up to an existing database system somehow. That
makes great sense. If I was writing an e-commerce application with
Squeak, that is what I would probably do myself (like Squeak to DB2 or
Oracle or Berkley DB (SleepyCat) or PostgreSQL etc.).

However, I want to put transactions into Pointrel under Squeak with just
Smalltalk code.

In general, putting transactions into Squeak has been awkward for two
reasons:
* "flush" doesn't really talk to the OS. It just seeks back to the file
start and the old position and hopes for the best. The comment says this
works under some OSs. Which ones? It looks like you can't count on flush
to work. Without knowing when or if data is committed before moving on,
it is hard to do transactions.

StandardFileStream>>flush
	"In some OS's seeking to 0 and back will do a flush"
	| p |
	p _ self position.
	self position: 0; position: p

* You can't truncate files (this comment indicated because the Mac
can't?). Code that depends on the file size or knowing that the
transaction goes to the end of the file won't work. It needs to be
modified to be "blank tolerant" at the end of the file. The best you can
hope for is the using StandardFileStream>>padToEndWith: aChar 
to pad null characters, and it is buggy though fixable (see previous
post).

I've been able to work around the second problem using the padding
(although it makes the code more cluttered and slower). I can't see a
way around the first issue (flush) without making changes to the VM or
doing FFI, pluggables, etc.

Does anyone have more experience with "flush" under Squeak?

-Paul Fernhout
Kurtz-Fernhout Software 
=========================================================
Developers of custom software and educational simulations
Creators of the Garden with Insight(TM) garden simulator
http://www.kurtz-fernhout.com





More information about the Squeak-dev mailing list