code: func (db *DB) init() error {
  	// Set the page size to the OS page size.
  	db.pageSize = os.Getpagesize()
  
  	// Create two meta pages on a buffer.
  	buf := make([]byte, db.pageSize*4)
  	for i := 0; i < 2; i++ {
  		p := db.pageInBuffer(buf[:], pgid(i))
  		p.id = pgid(i)
  		p.flags = metaPageFlag
  
  		// Initialize the meta page.
  		m := p.meta()
  		m.magic = magic
  		m.version = version
  		m.pageSize = uint32(db.pageSize)
  		m.freelist = 2
  		m.root = bucket{root: 3}
  		m.pgid = 4
  		m.txid = txid(i)
  		m.checksum = m.sum64()
  	}
  
  	// Write an empty freelist at page 3.
  	p := db.pageInBuffer(buf[:], pgid(2))
  	p.id = pgid(2)
  	p.flags = freelistPageFlag
  	p.count = 0
  
  	// Write an empty leaf page at page 4.
  	p = db.pageInBuffer(buf[:], pgid(3))
  	p.id = pgid(3)
  	p.flags = leafPageFlag
  	p.count = 0
  
  	// Write the buffer to our data file.
  	if _, err := db.ops.writeAt(buf, 0); err != nil {
  		return err
  	}
  	if err := fdatasync(db); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // init creates a new database file and initializes its meta pages.