From 2e8b1546be201032c6a6bf631467961d77118546 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 24 Jul 2015 14:27:14 +1000 Subject: [PATCH] Declared InMessage. --- internal/buffer/in_message.go | 54 ++++++++++++++++++++++++++++++++++ internal/buffer/out_message.go | 3 +- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 internal/buffer/in_message.go diff --git a/internal/buffer/in_message.go b/internal/buffer/in_message.go new file mode 100644 index 0000000..26386d6 --- /dev/null +++ b/internal/buffer/in_message.go @@ -0,0 +1,54 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package buffer + +import ( + "errors" + "io" + "unsafe" + + "github.com/jacobsa/fuse/internal/fusekernel" +) + +// An incoming message from the kernel, including leading fusekernel.InHeader +// struct. Provides storage for messages and convenient access to their +// contents. +type InMessage struct { +} + +// Initialize with the data read by a single call to r.Read. The first call to +// Consume will consume the bytes directly after the fusekernel.InHeader +// struct. +func (m *InMessage) Init(r io.Reader) (err error) { + err = errors.New("TODO") + return +} + +// Return a reference to the header read in the most recent call to Init. +func (m *InMessage) Header() (h *fusekernel.InHeader) { + panic("TODO") +} + +// Consume the next n bytes from the message, returning a nil pointer if there +// are fewer than n bytes available. +func (m *InMessage) Consume(n uintptr) (p unsafe.Pointer) { + panic("TODO") +} + +// Equivalent to Consume, except returns a slice of bytes. The result will be +// nil if Consume fails. +func (m *InMessage) ConsumeBytes(n uintptr) (b []byte) { + panic("TODO") +} diff --git a/internal/buffer/out_message.go b/internal/buffer/out_message.go index 123a141e..0fe8ef4 100644 --- a/internal/buffer/out_message.go +++ b/internal/buffer/out_message.go @@ -25,7 +25,8 @@ import ( // message from multiple segments, where the first segment is always a // fusekernel.OutHeader message. // -// Must be created with New. Exception: the zero value has Bytes() == nil. +// Must be created with NewOutMessage. Exception: the zero value has +// Bytes() == nil. type OutMessage struct { slice []byte }